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
Jnis
Frequent Visitor

DAX: Calculate Previous Month Sum, doesnt work

Hey,
I tried to sum up some values out of the previous month, like this:

 

Unbenannt.PNG

 

It is just an example for me, so I can practise DAX and learn it - but it doesnt work at all and I have absolutely no clue why It's not working.
Can you please give me some hints?

Thanks,
Jnis

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Jnis

 

You should create the measure with your formula, then you will get the right output.

 

Measure =
CALCULATE ( SUM ( 'Table'[Gesamt] ), PREVIOUSMONTH ( 'Table'[Period] ) )

 

 

Capture.PNG

 

For reference, you could have a good look at of this blog Understanding calculated column and Measures.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Jnis

 

You should create the measure with your formula, then you will get the right output.

 

Measure =
CALCULATE ( SUM ( 'Table'[Gesamt] ), PREVIOUSMONTH ( 'Table'[Period] ) )

 

 

Capture.PNG

 

For reference, you could have a good look at of this blog Understanding calculated column and Measures.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Floriankx
Solution Sage
Solution Sage

Hello,

 

You can try:

Calc=CALCULATE(SUM(...),PREVIOUSYEAR(...),ALL('Tabelle1'[Periode])

Generally in such cases it is recommended to have separate DateTables to relate to.

Your formula should then work perfectly as measure instead of calculated column.

 

The structure of your Table isn't ideal for PowerPivot. You should check out Unpivot.

 

Additionally: Here are two links for starters.

 

 

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.