Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Total Amount of last Month

Hello Everyone

I have to create a measure for the whole month but I need previous month data. how to modify this.?

 

TM Avg Accessory =
CALCULATE (
SUM(LastMonthAverge[Accessory15]),
FILTER (
ALL ( Calender ),
 
(Calender[MonthYear]) = MAX (Calender[MonthYear])
))
1 ACCEPTED SOLUTION
Anonymous
Not applicable

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.

 

2019-07-24_22h19_26.png

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
    )
) 

 

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

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.

 

2019-07-24_22h19_26.png

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
    )
) 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.