Forum Discussion

SQuazi's avatar
SQuazi
Frequent Visitor
1 year ago
Solved

Calculate min value based on user Selection

Hi All,

 

I have a sample data like below:

where i want to calculate min of (D_Factor) .

For Example1: if user selects Product=P1 and Country=C1 then Result=min( D_Product and D_Country)=0.5

Example 2: if user selects Product=P1 then Result=min(D_Product)=1

 

Kindly suggest DAX to achieve the above results based on dynamic user selections.

would appreciate your help

 

Regards,

Sabahat

 

  • Anonymous's avatar
    Anonymous
    1 year ago

    Thanks for the reply from lbendlin , please allow me to provide another insight:

    Hi, SQuazi 

    Regarding the issue you raised, my solution is as follows:

    1.Firstly, I have created your sample data based on your description as follows:

    2. Below are the measure I've created for your needs:

    Min_D_Factor_All = 
    MINX(
        {
            IF(ISFILTERED('Table'[Product]), MIN('Table'[D Product]), BLANK()),
            IF(ISFILTERED('Table'[Category]), MIN('Table'[D Category]), BLANK()),
            IF(ISFILTERED('Table'[Country]), MIN('Table'[D Country]), BLANK()),
            IF(ISFILTERED('Table'[Level]), MIN('Table'[D Level]), BLANK()),
            IF(ISFILTERED('Table'[Skill]), MIN('Table'[D Skill]), BLANK())
        },
        [Value]
    )
    

    3.Here's my final result, which I hope meets your requirements.

     

     

     

    Please find the attached pbix relevant to the case.

     

    Best Regards,

    Leroy Lu

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

     

6 Replies