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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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

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

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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