Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Invesco
Helper V
Helper V

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
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

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

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.