Forum Discussion

ScaR's avatar
ScaR
Regular Visitor
6 years ago
Solved

What if parameter

I'm new to Power BI. I'm trying to have a card for total sales % and use what if parameter to adjust the quantity sold of only one product to see that impact on the sales.    I have a slicer for th...
  • Greg_Deckler's avatar
    Greg_Deckler
    6 years ago

    ScaR what do you think of this solution?

     

    Total Profit = 
        VAR __Product = SELECTEDVALUE('Table'[Product],BLANK())
        VAR __NewQty = [QtyValue]
        VAR __Table = 
            ADDCOLUMNS(
                ADDCOLUMNS(
                    ALL('Table'),
                    "__NewQty",IF('Table'[Product] = __Product,__NewQty,[Qty])
                ),
                "__Total Profit",'Table'[Profit] * [__NewQty]
            )        
    RETURN
        SUMX(__Table,[__Total Profit])

     

    Attached PBIX