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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

How to graph percent change over time

I have a Sales table as seen below(actually about 2000 rows from 4 different months).

IDSumDate
1102022-01
2502022-02
31002022-03
4252022-04

 

I also have a calendar date table that shows all the dates between the first and last date, structured as follows.

Calendar = CALENDAR(FIRSTDATE(Sales[Date]),LASTDATE(Sales[Date])))

 

I want to graph the percent change over time between the months. Essentially it should graph the percent change from sum of ID 1 to 2 being 400%, 2 to 3 being 100%, and 3 to 4 being -75%. I am hoping to have this be dynamic so as I had new data, it will calculate the sum of percent change between months.

 

I've tried following quite a few online guides but I cannot get the formulas to graph this right.

 

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

Hi @Anonymous,

You can try to use the following measure formula to use the id as index to loop and calculate the dynamic difference:

formula =
VAR currID =
    MAX ( Table[ID] )
VAR prevID =
    CALCULATE ( MAX ( Table[ID] ), FILTER ( ALLSELECTED ( Table ), [ID] < currID ) )
VAR currValue =
    SUM ( Table[Sum] )
VAR prevValue =
    CALCULATE (
        SUM ( Table[Sum] ),
        FILTER ( ALLSELECTED ( Table ), [ID] = prevID )
    )
RETURN
    IF ( prevValue <> BLANK (), DIVIDE ( currValue - prevValue, prevValue ) )

Regards,

Xiaxoin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

You can try to use the following measure formula to use the id as index to loop and calculate the dynamic difference:

formula =
VAR currID =
    MAX ( Table[ID] )
VAR prevID =
    CALCULATE ( MAX ( Table[ID] ), FILTER ( ALLSELECTED ( Table ), [ID] < currID ) )
VAR currValue =
    SUM ( Table[Sum] )
VAR prevValue =
    CALCULATE (
        SUM ( Table[Sum] ),
        FILTER ( ALLSELECTED ( Table ), [ID] = prevID )
    )
RETURN
    IF ( prevValue <> BLANK (), DIVIDE ( currValue - prevValue, prevValue ) )

Regards,

Xiaxoin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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