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
Anonymous
Not applicable

Max Annual Percentage Change

Dear all,

 

I have a Sharepoint list that looks like the attached (with lots more quarter dates and lots more cities).

 

I'm creating a dashboard that analyses these numbers. The user only gets to select their quarter.

 

How can I create a formula that returns the best performing city defined as having the highest annual percentage increase in price in that selected quarter?

 

Any advice greatly welcomed.

 

Many thanks

Katie

 

roxannej86_1-1678742199804.png

 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous ,

 

I think you can try this code to create a measure to calculate the best performance city.

Best Performing City =
VAR _SELECTQUARTER =
    SELECTEDVALUE ( DimQuarter[Quarter] )
VAR _QUARTERLASTYEAR =
    EOMONTH ( _SELECTQUARTER, -12 )
VAR _SUMMAIRZE =
    SUMMARIZE (
        'Table',
        'Table'[City],
        "Change",
            VAR _CUR =
                CALCULATE ( SUM ( 'Table'[Price] ), 'Table'[Quarter] = _SELECTQUARTER )
            VAR _PRE =
                CALCULATE ( SUM ( 'Table'[Price] ), 'Table'[Quarter] = _QUARTERLASTYEAR )
            RETURN
                DIVIDE ( _CUR - _PRE, _PRE )
    )
RETURN
    MAXX ( FILTER ( _SUMMAIRZE, [Change] = MAXX ( _SUMMAIRZE, [Change] ) ), [City] )

Result is as below.

RicoZhou_0-1678865074556.png

 

Best Regards,
Rico Zhou

 

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

2 REPLIES 2
Anonymous
Not applicable

I really appreciate the response - I had to solve the problem yesterday so managed to do it a different (less elegant!) way but will mark yours as a solution as it certainly looks like it's done the trick!

v-rzhou-msft
Community Support
Community Support

Hi @Anonymous ,

 

I think you can try this code to create a measure to calculate the best performance city.

Best Performing City =
VAR _SELECTQUARTER =
    SELECTEDVALUE ( DimQuarter[Quarter] )
VAR _QUARTERLASTYEAR =
    EOMONTH ( _SELECTQUARTER, -12 )
VAR _SUMMAIRZE =
    SUMMARIZE (
        'Table',
        'Table'[City],
        "Change",
            VAR _CUR =
                CALCULATE ( SUM ( 'Table'[Price] ), 'Table'[Quarter] = _SELECTQUARTER )
            VAR _PRE =
                CALCULATE ( SUM ( 'Table'[Price] ), 'Table'[Quarter] = _QUARTERLASTYEAR )
            RETURN
                DIVIDE ( _CUR - _PRE, _PRE )
    )
RETURN
    MAXX ( FILTER ( _SUMMAIRZE, [Change] = MAXX ( _SUMMAIRZE, [Change] ) ), [City] )

Result is as below.

RicoZhou_0-1678865074556.png

 

Best Regards,
Rico Zhou

 

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

 

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.