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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
hejszyszky
Helper II
Helper II

Cumulative total of calculaton

 
1 ACCEPTED SOLUTION

@hejszyszky 

Try like

 

Risk M vs M-1 Cumm = if( not(isblank(IAR_Final_Database[Risk M])) && HASONEVALUE(Periods[Period]), CALCULATE(sumx(values(Periods[Period]),[Risk M vs M-1]), filter(ALLSELECTED(Periods), Periods[Period] <= max(Periods[Period]) )) -CALCULATE([Risk M vs M-1],Periods[Period]=0) , BLANK())

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

7 REPLIES 7
hejszyszky
Helper II
Helper II

Desired output :

2021-12-21_12h52_06.png

I've provided you file on private message, will post result once solved 

amitchandak
Super User
Super User

@hejszyszky ,

VAR RowDate = max(Periods[Period])
RETURN
CALCULATE (
calculate(IAR_Final_Database[Risk M vs M-1]),
FILTER (
IAR_Final_Database,
IAR_Final_Database[Period] <= RowDate  && IAR_Final_Database[Period] >0  ))

 

or

 

 

VAR RowDate = max(Periods[Period])
RETURN
CALCULATE (
calculate(IAR_Final_Database[Risk M vs M-1]),
FILTER (
allselected(IAR_Final_Database),
IAR_Final_Database[Period] <= RowDate  && IAR_Final_Database[Period] >0  )) +0

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

2021-12-21_12h33_45.png

 Ive tried that and its still outputting same values. I guess there is a problem with columns 1-3.

Maybe you could find somwhere a mistake:

COl 1 formula : 

Risk M = calculate(SUM('IAR_Final_Database'[Finance Risk]))
Col 2 :
Risk M-1 = CALCULATE(sum('IAR_Final_Database'[Finance Risk]),PREVIOUSMONTH(DATESMTD(Periods[Date])),all(Periods[Period]))
Col 3:
Risk M vs M-1 =

calculate(IAR_Final_Database[Risk M],filter(Periods,Periods[Period]<>0)) - calculate(IAR_Final_Database[Risk M-1])
 
Where table periods looks like :
2021-12-21_12h36_16.png
 
 
Do you see where is the catch/problem ?

@hejszyszky , Try like

 

VAR RowDate = max(Periods[Period])
RETURN
CALCULATE (
calculate(IAR_Final_Database[Risk M vs M-1]),
FILTER (
IAR_Final_Database,
IAR_Final_Database[Period] <= RowDate -1 ))

 

I think You need till last month.

 

or

Can you share sample data and sample output in table format?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Still getting output as below:

2021-12-21_12h01_22.png

 

 

 

Where my desired output is : 

 

2021-12-21_12h52_06.png

@hejszyszky , Shared file on mail

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@hejszyszky 

Try like

 

Risk M vs M-1 Cumm = if( not(isblank(IAR_Final_Database[Risk M])) && HASONEVALUE(Periods[Period]), CALCULATE(sumx(values(Periods[Period]),[Risk M vs M-1]), filter(ALLSELECTED(Periods), Periods[Period] <= max(Periods[Period]) )) -CALCULATE([Risk M vs M-1],Periods[Period]=0) , BLANK())

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.