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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Create Running totals with What-if measures.

I am trying to prompt two variables from the user to illustrate the trend over 12 months.

 

I have used what-if function here to prompt two values from the user.

1. Parameter[Parameter Value]

2. Parameter 2[Parameter Value 2]

 

While running a calculated field based on multiplying the two Parameters, I have got:

 

Outlook Margin = IF('Sales'[Actual margin] == 0, Parameter[Parameter Value]*'Parameter 2'[Parameter Value 2], 'Sales'[Actual margin])
 
On creating a running total based on this,
 
adambal_0-1658120586501.png

 

I am running into my issue.
Running total does not add the replaced values by the parameter. 
adambal_1-1658120612271.png

 How do I change my Outlook Margin RT to include values from August?

1 ACCEPTED SOLUTION

@Anonymous ,  Try a measure like this, prefer a date table

 

Cumm = CALCULATE(Sumx(values('Date'[Month Year]),[Outlook Margin]) ,filter(allselected('Date'),'Date'[date] <=max('Date'[date])))

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

4 REPLIES 4
Anonymous
Not applicable

@Anonymous ,  Try a measure like this, prefer a date table

 

Cumm = CALCULATE(Sumx(values('Date'[Month Year]),[Outlook Margin]) ,filter(allselected('Date'),'Date'[date] <=max('Date'[date])))

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
Anonymous
Not applicable

Thanks for the replay @amitchandak. I wanted to know how I can include a month condition element into Outlook margin when I want a sepecific month along with 'Sales'[Actual margin] == 0?

Outlook Margin = IF('Sales'[Actual margin] == 0Parameter[Parameter Value]*'Parameter 2'[Parameter Value 2]'Sales'[Actual margin])

 

I tried this, however the second condition does not seem to work, 

Outlook Margin Oct = IF(AND('Sales'[Actual margin] == 0,DATE(2022,10,31)), 'Parameter Margin'[Parameter Value]*'Parameter Volume'[Parameter Value 2], 'Sales'[Actual margin])
Anonymous
Not applicable

Hi @Anonymous,

You can't directly use date value as condition in if statement, I'd like to suggest you add the date field to compare with this values:

Outlook Margin Oct =
IF (
    AND ( 'Sales'[Actual margin] = 0, 'Sales'[Date] = DATE ( 2022, 10, 31 ) ),
    'Parameter Margin'[Parameter Value] * 'Parameter Volume'[Parameter Value 2],
    'Sales'[Actual margin]
)

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors