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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Invesco
Helper V
Helper V

DAX measure not totally working missing total percentage values

Hi Experts 

 

The following DAX measure nearly works but does not return the % Values for the red highlighted section as shown in the image. I cannot see my error in the measure below

Previously Level 3 was not working now Level 2 is not returning back the expected result. All the slicer and filter are in the same table.

 

Measure 

Packs Market Share =
VAR _PacksCash = [Packs]

VAR _All_PacksCash_Product =
CALCULATE([Packs], removefilters(dev_hpa_sales_2[hpa_national_desc],dev_hpa_sales_2[level_1_element_desc],dev_hpa_sales_2[level_2_element_desc],dev_hpa_sales_2[level_3_element_desc]))
VAR _All_PacksCash_Market_1 =
CALCULATE([Packs], removefilters(dev_hpa_sales_2[level_1_element_desc],dev_hpa_sales_2[level_2_element_desc],dev_hpa_sales_2[level_3_element_desc]))

VAR _All_PacksCash_Market_2 =
CALCULATE([Packs], removefilters(dev_hpa_sales_2[level_2_element_desc],dev_hpa_sales_2[level_3_element_desc]))

VAR _All_PacksCash_Market_3 =
CALCULATE([Packs], removefilters(dev_hpa_sales_2[level_3_element_desc]))


VAR _Pct_of_Product =
    DIVIDE(_PacksCash,_All_PacksCash_Product,0)

VAR _Pct_of_Market_1 =
    DIVIDE(_PacksCash,_All_PacksCash_Market_1,0)

VAR _Pct_of_Market_2 =
    DIVIDE(_PacksCash,_All_PacksCash_Market_2,0)

VAR _Pct_of_Market_3 =
    DIVIDE(_PacksCash,_All_PacksCash_Market_3,0)


VAR _Result =
SWITCH(TRUE(),
        ISINSCOPE( dev_hpa_sales_2[level_2_element_desc]), _Pct_of_Market_3,
        ISINSCOPE( dev_hpa_sales_2[level_2_element_desc]), _Pct_of_Market_2,
        ISINSCOPE( dev_hpa_sales_2[level_2_element_desc]), _Pct_of_Market_1,
        ISINSCOPE( dev_hpa_sales_2[dataset_desc]), _Pct_of_Product,
_Pct_of_Product )

Return
   _Result

 

 

Invesco_0-1675757440690.png

 

0 REPLIES 0

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.