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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
alan7lp
Helper III
Helper III

What if parameter based on slicer selection

Hello there,

 

I have created a what if parameter that works as it's supposed to: based on the % selected it increases/decreases the amount in PCS and $:

 

 

Parameter = SELECTEDVALUE('Adjusted Need'[Parameter Value], 0)
Adjusted Need in PCS = [NEED] * (1 + 'Adjusted Need'[Parameter Value])

Adjusted Need in $ = [NEED in $] * (1 + 'Adjusted Need'[Parameter Value])

 

 

 

With a -22% selected in the parameter this is the result:

 

PRODUCTNEED IN $ADJUSTED NEED IN $NEED IN PCSADJUSTED NEED IN PCS
PRODUCT A€ 17,459,152€ 13,618,138546,898426,580
PRODUCT B€ 16,781,109€ 13,089,265785,704612,849
PRODUCT C€ 8,278,878€ 6,457,525121,02894,402
PRODUCT D€ 13,693,814€ 10,681,175152,047118,597
PRODUCT E€ 3,033,191€ 2,365,889108,76984,840
PRODUCT F€ 4,846,410€ 3,780,20044,26434,526
PRODUCT G€ 9,244,541€ 7,210,742110,16085,925
PRODUCT H€ 1,060,012€ 826,81045,67235,624
total:€ 74,397,107€ 58,029,7441,914,5421,493,343

 

Now, what I am after is if having an slicer for the PRODUCT category and selecting 1 or more, show the increase/decrease only on those products selected, example:

 

PRODUCT A and B selected on a slicer with an increase of 10% then:

 

PRODUCTNEED IN $ADJUSTED NEED IN $NEED IN PCSADJUSTED NEED IN PCS
PRODUCT A€ 17,459,152€ 19,205,067546,898601,588
PRODUCT B€ 16,781,109€ 18,459,220785,704864,274
PRODUCT C€ 8,278,878€ 8,278,878121,028121,028
PRODUCT D€ 13,693,814€ 13,693,814152,047152,047
PRODUCT E€ 3,033,191€ 3,033,191108,769108,769
PRODUCT F€ 4,846,410€ 4,846,41044,26444,264
PRODUCT G€ 9,244,541€ 9,244,541110,160110,160
PRODUCT H€ 1,060,012€ 1,060,01245,67245,672
total:€ 74,397,107€ 77,821,1331,914,542 2,047,802

 

So, if 1 or more value is selected in the slicer of PRODUCTS, recalculate accordingly but still be able to show me the grand total as per table above. If nothing is selected, then wathever percentage selected in my parameter should affect all data.

 

Is this possible?

Thanks in advance for having a look into it and if anything else or better explanation is needed, please let me know so I can help to you to help me 🙂

 

Best regards,

Alan.

4 REPLIES 4
alan7lp
Helper III
Helper III

Hi there,

 

I am having an issue with (I believe) something which might be easier to solve than what I think yet I can have it working.

I want to achieve the following:

Capture.JPG

 

I have 3 measures created in PBI: REAL PRICE, ADJUSTED PRICE (+) and ADJUSTED PRICE (-). Basically I want to replicate what this IF STATMENT in Excel is managing to do correctly (column FINAL ADJUSTED PRICE).

 

I tried writing the same logic in PBI but I will get either the positive adjustement or the negative one (depending on which statment I write first). For example, it will give me correct result for PRODUCT A (150) but for PRODUCT C gives me 300 (it should be 50).

 

Is there anyway this can be worked out?

Thanks a lot 

 

Cheers.

Hi @alan7lp ,

Please try the following formula for column FINAL ADJUSTED PRICE in Power BI Desktop:

FINAL ADJUSTED PRICE =
IF (
    AND (
        'PRODUCT'[ADJUSTED PRICE (+)] > 'PRODUCT'[REAL PRICE],
        'PRODUCT'[ADJUSTED PRICE (+)] > 'PRODUCT'[ADJUSTED PRICE (-)]
    ),
    'PRODUCT'[ADJUSTED PRICE (+)],
    IF (
        AND (
            'PRODUCT'[ADJUSTED PRICE (-)] < 'PRODUCT'[REAL PRICE],
            'PRODUCT'[ADJUSTED PRICE (-)] < 'PRODUCT'[ADJUSTED PRICE (+)]
        ),
        'PRODUCT'[ADJUSTED PRICE (-)],
        'PRODUCT'[REAL PRICE]
    )
)

if.JPG

Best Regards

Rena

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

Thanks @v-yiruan-msft for your reply.

 

I have tried that way before (as it's the same than excel for that matter) and logacally it does work but the problem in my case is that all the data you have in columns are measures. So, REAL PRICE and the ADJUSTED are built in DAX, not columns in a data table and I guess that is why it doesn't work.

 

But like I said, your solution is logical and would work if my data was set up as that.

 

Thanks again for your time.

 

regards

Greg_Deckler
Super User
Super User

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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