Forum Discussion

verma_isha02's avatar
verma_isha02
Frequent Visitor
3 years ago
Solved

Need help with DAX measure

HI All, I have a table like below in Power BI -   I need help in creating DAX calculation where as an example for Germany, I would need - Value in collumn B - MIN(Value in column b for the c...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi, verma_isha02 ,

     

    Here I create a sample to have a test.

    I think A/B/C may be measures.

    Measure:

    Measure = 
    VAR _PART1 = [B]
    VAR _1 =
        SUMMARIZE ( ALL ( 'Table' ), 'Table'[Country], "B", [B] )
    VAR _2 =
        ADDCOLUMNS (
            _1,
            "MINVALUE",
                MINX ( FILTER ( _1, [B] < EARLIER ( [B] ) && [B] <> 0 ), [B] )
        )
    VAR _PART2 =
        SUMX ( FILTER ( _2, [Country] = MAX ( 'Table'[Country] ) ), [MINVALUE] )
    RETURN
        DIVIDE ( ( _PART1 - _PART2 ) * [C], [A] )

    Result is as below.

     

    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.