cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Jaizeism Frequent Visitor
Frequent Visitor

Running total of a measure based on an IF statement?

Hi! I have the following table

wherein the first column M1Count counts all the flags of all the StoreID, the 2nd column M2Count is the same measure as M1Count but for the next month. M3Count is the same but for the next 2nd month.

 

1.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

M2 and M3 count relies on an IF statement such as this:

 

CountBlank2 = CALCULATE(COUNTX ( VALUES ( 'Store Invoice'[Store ID] ), 'Secondary Sales Invoices'[Net Secondary Amount - Invoiced]) ,NEXTMONTH('Date'[Date]))
 
M2Count = IF([CountBlank2] = BLANK(), [M1Count], 1)
 
My question is how do I get the running total of M2Count and M3Count because I can't do it with SUM or CALCULATE functions as it does not accept my column.

UPDATE: I have changed the formula of the M2Count and M3Count to the following:

M2Count = CALCULATE(IF([CountBlank2] = BLANK(), [M1Count], [CountBlank2]))
M3Count = (IF([CountBlank4] = BLANK(), [M2Count], [CountBlank4]))
 
Although it does sum the column, the resulting total is wrong
4.PNG
 
Upon validation in Excel, the Total should be the following:
5.PNG
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Running total of a measure based on an IF statement?

@Jaizeism 

 

You may take a look at the post below.

https://community.powerbi.com/t5/Desktop/Power-BI-desktop-not-calculating-total-for-measure-in-Matri...

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
Jaizeism Frequent Visitor
Frequent Visitor

Re: Running total of a measure based on an IF statement?

UPDATE: I have changed the formula of the M2Count and M3Count to the following:

M2Count = CALCULATE(IF([CountBlank2] = BLANK(), [M1Count], [CountBlank2]))
M3Count = (IF([CountBlank4] = BLANK(), [M2Count], [CountBlank4]))
 
Although it does sum the column, the resulting total is wrong
4.PNG
 
Upon validation in Excel, the Total should be the following:
5.PNG
Jaizeism Frequent Visitor
Frequent Visitor

Re: Running total of a measure based on an IF statement?

Can anyone help me with this? Smiley Sad Thanks a lot.

Community Support Team
Community Support Team

Re: Running total of a measure based on an IF statement?

@Jaizeism 

 

You may take a look at the post below.

https://community.powerbi.com/t5/Desktop/Power-BI-desktop-not-calculating-total-for-measure-in-Matri...

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

Helpful resources

Announcements
Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 134 members 1,698 guests
Please welcome our newest community members: