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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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