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
fxv_anton
Frequent Visitor

Pivot, Multiple value: Sum / Average / calculation

Hi Experts, need your help / advise on this:

Expected outcome, with correct on the KPI reach which is suppose to be "average" OR calculation based on 40% prio 2, 30%prio3, 30% prio4). 

Reports.JPG

 

From the following transform data; could you advise on what is the best way to carry out the activity? 

CC Assignment Group Prio Value Year Category
CC1 GRP1 3 - Average 200 2020-05 # of Incidents (*)
CC1 GRP1 3 - Average 210 2020-04 # of Incidents (*)
CC1 GRP1 3 - Average 180 2020-03 # of Incidents (*)
CC1 GRP1 3 - Average 168 2020-02 # of Incidents (*)
CC1 GRP1 3 - Average 182 2020-01 # of Incidents (*)
CC1 GRP1 4 - Low 37 2020-05 # of Incidents (*)
CC1 GRP1 4 - Low 61 2020-04 # of Incidents (*)
CC1 GRP1 4 - Low 47 2020-03 # of Incidents (*)
CC1 GRP1 4 - Low 46 2020-02 # of Incidents (*)
CC1 GRP1 4 - Low 47 2020-01 # of Incidents (*)
CC1 GRP1 2 - High 2 2020-03 # of Incidents (*)
CC1 GRP1 2 - High 4 2020-01 # of Incidents (*)
CC1 GRP1 2 - High 1 2020-02 # of Incidents (*)
CC1 GRP1 3 - Average 100 2020-05 KPI reached
CC1 GRP1 3 - Average 100 2020-04 KPI reached
CC1 GRP1 3 - Average 100 2020-03 KPI reached
CC1 GRP1 3 - Average 100 2020-02 KPI reached
CC1 GRP1 3 - Average 100 2020-01 KPI reached
CC1 GRP1 4 - Low 100 2020-05 KPI reached
CC1 GRP1 4 - Low 100 2020-04 KPI reached
CC1 GRP1 4 - Low 100 2020-03 KPI reached
CC1 GRP1 4 - Low 100 2020-02 KPI reached
CC1 GRP1 4 - Low 100 2020-01 KPI reached
CC1 GRP1 2 - High 100 2020-03 KPI reached
CC1 GRP1 2 - High 100 2020-02 KPI reached
CC1 GRP1 2 - High 100 2020-01 KPI reached
CC1 GRP1 2 - High 0 2020-03 # of Breaches
CC1 GRP1 2 - High 0 2020-02 # of Breaches
CC1 GRP1 2 - High 0 2020-01 # of Breaches
CC1 GRP1 4 - Low 0 2020-05 # of Breaches
CC1 GRP1 4 - Low 0 2020-04 # of Breaches
CC1 GRP1 4 - Low 0 2020-03 # of Breaches
CC1 GRP1 4 - Low 0 2020-02 # of Breaches
CC1 GRP1 4 - Low 0 2020-01 # of Breaches
CC1 GRP1 3 - Average 0 2020-05 # of Breaches
CC1 GRP1 3 - Average 0 2020-04 # of Breaches
CC1 GRP1 3 - Average 0 2020-03 # of Breaches
CC1 GRP1 3 - Average 0 2020-02 # of Breaches
CC1 GRP1 3 - Average 0 2020-01 # of Breaches

1 ACCEPTED SOLUTION

Hi @fxv_anton ,

 

Has your problem been solved?

Please do like this.

 

Measure = 
IF(
    MAX(Sheet4[Category]) = "KPI reached",
    IF(
        HASONEFILTER( Sheet4[Value] ),
        SUM(Sheet4[Value]),
        AVERAGE( Sheet4[Value] )
    ),
    SUM(Sheet4[Value])
)

lll4.PNG

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

6 REPLIES 6
v-lionel-msft
Community Support
Community Support

Hi @fxv_anton,

 

Try to do like this.

Measure = 
IF(
    HASONEFILTER('Sales (2)'[Sale 2015]),
    SUM('Sales (2)'[Sale 2015]),
    AVERAGE('Sales (2)'[Sale 2015] )
)

eee2.PNG

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks @v-lionel-msft 

I tried it out, and it work well for the KPI. 

However, could I have mix value? by doing this, I have correct figure for KPI (if taking average), but incorrect value for number of incident and number of breaches now. 
Thanks in advance for the support. 

Result with MeasureResult with Measure

Hi @fxv_anton ,

 

“but incorrect value for number of incident and number of breaches now...”

Can you mark the wrong data? I can't find the error.

Or can you paste your sample data in a table format? I can not use the text format.

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the continuous support @v-lionel-msft .

 

Correction: when I mention incorrect, I meant that is not the expected result.

When we calculate KPI, we could take average or using percentage calculation.

But when we talk about total number tickets and breaches, we should "sum it up". 

Hence, could we have mixed calculation in that aspects?

 

ExpectedReports.png

Data in Table: 

 

CCAssignment GroupPrioValueYearCategory

CC1GRP13 - Average200Friday, May 1, 2020# of Incidents (*)
CC1GRP13 - Average210Wednesday, April 1, 2020# of Incidents (*)
CC1GRP13 - Average180Sunday, March 1, 2020# of Incidents (*)
CC1GRP13 - Average168Saturday, February 1, 2020# of Incidents (*)
CC1GRP13 - Average182Wednesday, January 1, 2020# of Incidents (*)
CC1GRP14 - Low37Friday, May 1, 2020# of Incidents (*)
CC1GRP14 - Low61Wednesday, April 1, 2020# of Incidents (*)
CC1GRP14 - Low47Sunday, March 1, 2020# of Incidents (*)
CC1GRP14 - Low46Saturday, February 1, 2020# of Incidents (*)
CC1GRP14 - Low47Wednesday, January 1, 2020# of Incidents (*)
CC1GRP12 - High2Sunday, March 1, 2020# of Incidents (*)
CC1GRP12 - High4Wednesday, January 1, 2020# of Incidents (*)
CC1GRP12 - High1Saturday, February 1, 2020# of Incidents (*)
CC1GRP13 - Average100Friday, May 1, 2020KPI reached
CC1GRP13 - Average100Wednesday, April 1, 2020KPI reached
CC1GRP13 - Average100Sunday, March 1, 2020KPI reached
CC1GRP13 - Average100Saturday, February 1, 2020KPI reached
CC1GRP13 - Average100Wednesday, January 1, 2020KPI reached
CC1GRP14 - Low100Friday, May 1, 2020KPI reached
CC1GRP14 - Low100Wednesday, April 1, 2020KPI reached
CC1GRP14 - Low100Sunday, March 1, 2020KPI reached
CC1GRP14 - Low100Saturday, February 1, 2020KPI reached
CC1GRP14 - Low100Wednesday, January 1, 2020KPI reached
CC1GRP12 - High100Sunday, March 1, 2020KPI reached
CC1GRP12 - High100Saturday, February 1, 2020KPI reached
CC1GRP12 - High100Wednesday, January 1, 2020KPI reached
CC1GRP12 - High0Sunday, March 1, 2020# of Breaches
CC1GRP12 - High0Saturday, February 1, 2020# of Breaches
CC1GRP12 - High0Wednesday, January 1, 2020# of Breaches
CC1GRP14 - Low0Friday, May 1, 2020# of Breaches
CC1GRP14 - Low0Wednesday, April 1, 2020# of Breaches
CC1GRP14 - Low0Sunday, March 1, 2020# of Breaches
CC1GRP14 - Low0Saturday, February 1, 2020# of Breaches
CC1GRP14 - Low0Wednesday, January 1, 2020# of Breaches
CC1GRP13 - Average0Friday, May 1, 2020# of Breaches
CC1GRP13 - Average0Wednesday, April 1, 2020# of Breaches
CC1GRP13 - Average0Sunday, March 1, 2020# of Breaches
CC1GRP13 - Average0Saturday, February 1, 2020# of Breaches
CC1GRP13 - Average0Wednesday, January 1, 2020# of Breaches

 

 

 

Hi @fxv_anton ,

 

Has your problem been solved?

Please do like this.

 

Measure = 
IF(
    MAX(Sheet4[Category]) = "KPI reached",
    IF(
        HASONEFILTER( Sheet4[Value] ),
        SUM(Sheet4[Value]),
        AVERAGE( Sheet4[Value] )
    ),
    SUM(Sheet4[Value])
)

lll4.PNG

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Hi @v-lionel-msft  could you help to explain the logic behind this Max?

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.