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
mpataki32
Helper III
Helper III

Summarize a variable's result in a measure

I have a measure which is returning a percentage from 0-100% and I have a matrix table with 4 level (1 - highest, 4 - transactional level).

What I would like to achieve is that based on my measure I would like to have another measure which is returning "1" on the level 4th (transactional) and have a second calculation which will summarize the 4th level's "1" on the 3rd level

Elementary_KPI = the KPI which result is from 0% to 100%

 

--------------------------------------------------------------------------------

 

BASIC_KPI =

VAR
 CALC_KPI = IF([Elementary_KPI] <> 0,1)
VAR SUM_CALC_KPI = SUMX(IF([Elementary_KPI] <> 0,1))

VAR
FINAL =
  IF (ISINSCOPE('TABLE'[4th_level]),CALC_KPI
, IF (ISINSCOPE('TABLE'[3th_level]),SUM_CALC_KPI))
RETURN FINAL

So the scope is the to summarize CALC_KPI's result in the SUM_CALC_KPI, is it possible or did I approach this from a wrong direction? 
1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @mpataki32 

Please try formula as below:

CALC_KPI = IF([Elementary_KPI] <> 0,1)+0 
SUM_CALC_KPI = SUMX(VALUES('Table'),[CALC_KPI])
BASIC_KPI = 
IF (
    ISINSCOPE ( 'Table'[4th_level] ),
    [SUM_CALC_KPI],
    IF ( ISINSCOPE ( 'Table'[3th_level] ), [SUM_CALC_KPI], 'Table'[Elementary_KPI] )
)

result:

veasonfmsft_0-1652345122724.png

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @mpataki32 

Please try formula as below:

CALC_KPI = IF([Elementary_KPI] <> 0,1)+0 
SUM_CALC_KPI = SUMX(VALUES('Table'),[CALC_KPI])
BASIC_KPI = 
IF (
    ISINSCOPE ( 'Table'[4th_level] ),
    [SUM_CALC_KPI],
    IF ( ISINSCOPE ( 'Table'[3th_level] ), [SUM_CALC_KPI], 'Table'[Elementary_KPI] )
)

result:

veasonfmsft_0-1652345122724.png

Best Regards,
Community Support Team _ Eason

Hi @v-easonf-msft

Thank you so much for the help! One thing, you wrote the following code: 

 

  IF ( ISINSCOPE ( 'Table'[3th_level] ), [SUM_CALC_KPI], 'Table'[Elementary_KPI] )
)

 

I have to modify to that: 

 

  IF ( ISINSCOPE ( 'Table'[3th_level] ), [SUM_CALC_KPI], [Elementary_KPI] )
)

 

With this it is working now. 

 

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.