Forum Discussion

fabo's avatar
fabo
Advocate III
9 years ago
Solved

Conditional Top 20

Hi everyone.    I have this scenario: 219 plants ("Production Unit" or "PU") are located in 15 geographical regions. They produce only one product in different amounts. Data is collected monthly. V...
  • Vvelarde's avatar
    Vvelarde
    9 years ago

    fabo

     

    Hi, Please try with this measure:

     

    ProductionShow =
    IF (
        HASONEVALUE ( T_Region[Region] ),
        [Sum of Production],
        IF (
            COUNTROWS (
                INTERSECT (
                    VALUES ( T_PU[Production Unit] ),
                    TOPN ( 20, ALLSELECTED ( T_PU[Production Unit] ), [Sum of Production], DESC )
                )
            )
                > 0,
            [Sum of Production],
            BLANK ()
        )
    )

     

    Regards

     

    Victor

    Lima - Peru