Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

DAX Measure error - cannot see error on Level 2 and Level 5

Hi Experts 

 

I cannot see why Level 2 and Level 5 are returning back zero values when i have data for those points.

 

My Measure 

Packs Market Share =
VAR _PacksCash = [Packs]

VAR _All_PacksCash_Product =
    CALCULATE([Packs], ALLSELECTED(dev_rxa_sales_geog[description]))

VAR _Level2 =
    CALCULATE([Packs], ALLSELECTED(dev_hpa_sales_2[level_2_element_desc]))

VAR _Level3 =
    CALCULATE([Packs], ALLSELECTED(dev_hpa_sales_2[level_3_element_desc]))

VAR _Level4 =
    CALCULATE([Packs], ALLSELECTED(dev_hpa_sales_2[level_4_element_desc]))

VAR _Level5 =
    CALCULATE([Packs], ALLSELECTED(dev_hpa_sales_2[level_5_element_desc]))

VAR _Pct_of_Product =
    DIVIDE(_PacksCash,_All_PacksCash_Product,0)

VAR _Level2pct =
    DIVIDE(_PacksCash,_Level2,0)

VAR _Level3pct =
    DIVIDE(_PacksCash,_Level3,0)

VAR _Level4pct =
    DIVIDE(_PacksCash,_Level4,0)

VAR _Level5pct =
    DIVIDE(_PacksCash,_Level5,0)

VAR _Result =
    SWITCH( TRUE(),
        ISINSCOPE( dev_hpa_sales_2[level_5_element_desc]), _Level5pct,
        ISINSCOPE( dev_hpa_sales_2[level_4_element_desc]), _Level4pct,
        ISINSCOPE( dev_hpa_sales_2[level_3_element_desc]), _Level3pct,
        ISINSCOPE( dev_hpa_sales_2[level_2_element_desc]), _Level2pct,
        ISINSCOPE( dev_rxa_sales_geog[description]), _Pct_of_Product,
_Pct_of_Product )

Return
    _Result
  • Anonymous ,
    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

1 Reply

  • Anonymous ,
    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.