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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
mklangley
Frequent Visitor

What If Parameter -- Apply to total by category, not each row for that category.

Hello,

I am running into a problem applying a What If Parameter value how I need to, and am wondering if anyone can help.

I have a What If Parameter (its value, of course, can be chosen/changed by the user), and would like to apply its value to the total amount for Category = A.

Below is my data. There are two names: John and Steve. Notice that for John, there is one row for Category = A; for Steve, there are two rows for Category = A.

IDCategoryNameAmount
1AJohn30
2BJohn40
3CJohn50
4DJohn60
5ASteve70
6ASteve80
7BSteve90
8CSteve100
9DSteve110


This is my parameter: 

Parameter = GENERATESERIES(0, 10, 1)

 

This is Amount Plus Parameter measure:

Amount Plus Parameter = sumx('Table'
                                                    ,if('Table'[Category] = "A"
                                                       ,'Table'[Amount] + Parameter[Parameter Value]
                                                       ,'Table'[Amount]
                                                       )
                                                    )

The problem: The parameter value is being applied at the row level (since I am using SUMX); but that means that when there are multiple rows for Category = A, the Parameter value is being applied multiple times. 

For example, for John, this works--it adds the parameter value of 3 (since there is only one row for John where Category = A):

mklangley_0-1696600137397.png

But for Steve, it is adding the parameter value twice (since there are two rows for Category = A). I would like the total to be 153, not 156.

mklangley_1-1696600210685.png

And for All, it is applying the parameter value three times (since there are three rows for Category = A). I would like to see 183, not 189.

mklangley_2-1696600397456.png

So in short, I would like to apply the Parameter value to the total for Category = A, not row-by-row, while still allowing the flexibility to filter by name. Is that possible?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @mklangley ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure. 

Amount Plus Parameter = IF(MAX('Table'[Category])="A",SUM('Table'[Amount])+Parameter[Parameter Value],SUM('Table'[Amount]))

(3) Then the result is as follows.

vtangjiemsft_0-1696817852462.png

vtangjiemsft_2-1696817903422.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @mklangley ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure. 

Amount Plus Parameter = IF(MAX('Table'[Category])="A",SUM('Table'[Amount])+Parameter[Parameter Value],SUM('Table'[Amount]))

(3) Then the result is as follows.

vtangjiemsft_0-1696817852462.png

vtangjiemsft_2-1696817903422.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

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.