Forum Discussion

novotnajk's avatar
novotnajk
Icon for Resolver I rankResolver I
5 years ago
Solved

IF / AND Measure using Values from Two Tables to Display a Measure Value

Hi!   I have another tough formula to build (at least I think it's tough)!   I created two tables in my model called, "Plan Spend Category", and "Plan Spend Parameter" - These two tables, identif...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi novotnajk 

    I think you want to show different  results (measures) by select slicer.

    Firstly you need to build two slicer table.

    Category Table:

    Parameter Table:

    Due to I don't know your value, I build a sample measure for you. I use number to replace the measures you use.

     

    Measure = 
    VAR _Selcategory =
        SELECTEDVALUE ( 'Plan Spend Category'[Category] )
    VAR _Selparameter =
        SELECTEDVALUE ( 'Plan Spend Parameter'[Parameter] )
    VAR _Medical_PEPM = 1
    VAR _Medical_PMPM = 2
    VAR _Rx_PEPM = 3
    VAR _Rx_PMPM = 4
    VAR _Total_Amt_Paid = 5
    RETURN
        IF (
            ISFILTERED ( 'Plan Spend Category'[Category] )
                && ISFILTERED ( 'Plan Spend Parameter'[Parameter] ),
            IF (
                AND ( _Selcategory = "Medical", _Selparameter = "PEPM" ),
                _Medical_PEPM,
                IF (
                    AND ( _Selcategory = "Medical", _Selparameter = "PMPM" ),
                    _Medical_PMPM,
                    IF ( AND ( _Selcategory = "Rx", _Selparameter = "PEPM" ), _Rx_PEPM, _Rx_PMPM )
                )
            ),
            _Total_Amt_Paid
        )

     

    Result is as below. 

    As default it will show the result of _Total_Amt_Paid.

    If I select Medical and PEPM in Slicers, it will show the result of _Medical_PEPM.

    You can add more measures by var and update this measure like I show you above.

     

    You can download the pbix file from this link: IF / AND Measure using Values from Two Tables to Display a Measure Value

     

    If this reply still couldn't help you solve your problem, please show me more details about your data model.

    You can give me a sample table like you are dealing with, show me a screenshot of your data model or you can provide me with your pbix file by your Onedrive for business.

     

    Best Regards,

    Rico Zhou

     

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