cancel
Showing results for
Did you mean:
Highlighted
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.

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

Upon validation in Excel, the Total should be the following:
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team

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

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

Upon validation in Excel, the Total should be the following:
Frequent Visitor

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

Can anyone help me with this? Thanks a lot.

Community Support Team

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

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.

Announcements

#### Community News & Announcements

Get your latest community news and announcements.

#### Power Platform Summit North America

Register by September 5 to save \$200

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

#### Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 134 members 1,698 guests
Recent signins: