Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hello Everyone
I have to create a measure for the whole month but I need previous month data. how to modify this.?
Solved! Go to Solution.
It depends whats fields are available in you calendar dimension.
Once design pattern that I follow is to add a Month Number Over All field to my calendar (date) dimension. This allows you do do lots of different rolling averages, month based calculations with basic calcs.
You calculation could then look something like this:
TM Avg Accessory = CALCULATE ( SUM ( LastMonthAverge[Accessory15] ), FILTER ( ALL ( Calender ), ( [Calender[Month Number Overall] ) = MAX ( [Calender[Month Number Overall] ) - 1 ) )
Hi,
Create a Calendar Table and build a relationship from the Date column of the Data Table to the Date column of the Calendar Table. In the Calendar Table, extract the Year and Month by using these calculated column formulas: Year = Year(Calednar[Date]) and Month = FORMAT(Calendar[Date],"mmmm"). Drag Year and Month columns from the Calendar Table to the visual/slicer and select any one Year and Month. Write these measures
Total = SUM(LastMonthAverge[Accessory15])
Total PM = CALCULATE([Total],PREVIOUSMONTH(Calendar[Date]))
Hope this helps.
@Ashish_Mathur but this code didn't sum whole month value. its return just day by day result.
Hi,
In the filter/slicer, drag only the Year field from the Calendar Table and select any one year. To your Table visual, drag Month and then drag the 2 measures.
It depends whats fields are available in you calendar dimension.
Once design pattern that I follow is to add a Month Number Over All field to my calendar (date) dimension. This allows you do do lots of different rolling averages, month based calculations with basic calcs.
You calculation could then look something like this:
TM Avg Accessory = CALCULATE ( SUM ( LastMonthAverge[Accessory15] ), FILTER ( ALL ( Calender ), ( [Calender[Month Number Overall] ) = MAX ( [Calender[Month Number Overall] ) - 1 ) )
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
86 | |
86 | |
84 | |
67 | |
49 |
User | Count |
---|---|
131 | |
110 | |
97 | |
71 | |
67 |