Calculate Sales This week and Last Week using a Button in PowerBI | MI Tutorials

preview_player
Показать описание
Calculate Sales This week and Last Week using a Button in PowerBI | MI Tutorials

Code to Create Calendar:

Calendar =
VAR MinDate = MIN('50000 Sales Records'[Order Date])
Var MaxDate = Max('50000 Sales Records'[Order Date])
VAR Days = CALENDAR ( MinDate, MaxDate )
RETURN ADDCOLUMNS (
Days,
"Year", YEAR ( [Date] ),
"Month Number", MONTH ( [Date] ),
"Month", FORMAT ( [Date], "mmmm" ),
"Year Month Number", YEAR ( [Date] ) * 12 + MONTH ( [Date] ) - 1,
"Year Month", FORMAT ( [Date], "mmm yy" ),
"Week Number", WEEKNUM ( [Date] ),
"Week Number and Year", "W" & WEEKNUM ( [Date] ) & " " & YEAR ( [Date] ),
"WeekYearNumber", YEAR ( [Date] ) & 100 + WEEKNUM ( [Date] )
)
Рекомендации по теме
Комментарии
Автор

Hello. This tutorial is almost exactly what i was looking for.
What if i want to create this dax for the last closed month and see also how the previous 2-3 months of the last closed month performed?
For example, in December I have the data until November end and i want to go back 2-3 months to check the progress?
In this case the today will not work as there are no data for the month of December.
Thank you!

valiabis
Автор

Please show variance week wise and age also great help

lalitkaushik
Автор

Hi - I need current week vs last 6 weeks as an slicer filter so that anyone can easily select and view the data as per selection
My week starts from Friday to Thursday
Please assist

arpitsawant