Maruthipbi / PowerBI-project

PowerBI project
0 stars 0 forks source link

Power BI CODE REVIEW #1

Open Maruthipbi opened 6 months ago

Maruthipbi commented 6 months ago

Power BI DAX CODE FOR REVIEW:

Calender Table:

Calendar = ADDCOLUMNS ( CALENDAR (), "Year", YEAR ( [Date] ), "Month Number", MONTH ( [Date] ), "Month Name", FORMAT ( [Date], "MMMM" ), "Quarter", QUARTER ( [Date] ), "Day of Week Number", WEEKDAY ( [Date] ), "Day of Week Name", FORMAT ( [Date], "dddd" ), "Day of Month", DAY ( [Date] ), "Week of Year", WEEKNUM ( [Date], 2 ) )

SalesBreakdownByCountry = SUMMARIZE( 'Sales', 'Sales'[Country], "Total Sales", SUM('Sales'[Sales Amount]) )

Sales = Sales_Table[price_per_kg]*Sales_Table[weight_kg]

Vloumes = SUM(Sales_Table[weight_kg])

Week Over Week Comparison = VAR CurrentWeekSales = CALCULATE(SUM(Sales_Table[Sales]), 'Sales_Table'[Weeknum] = MAX('Sales_Table'[Weeknum])) VAR PreviousWeekSales = CALCULATE(SUM(Sales_Table[Sales]), 'Sales_Table'[Weeknum] = MAX('Sales_Table'[Weeknum]) - 1) RETURN IF(ISBLANK(PreviousWeekSales), BLANK(), (CurrentWeekSales - PreviousWeekSales) / PreviousWeekSales)

Weeknum = WEEKNUM(Sales_Table[date])

Maruthipbi commented 6 months ago

image

Maruthipbi commented 6 months ago

Coutry breakdownsales.zip