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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Percent Change Measure based on Filter

I have a database set up that provides the total T&E expense broken out by Area (Consulting, Education, etc.) by Quarter (2018 Q1, 2018 Q2, etc. stored as text). I am attaching an image as an example.

 

I have a clustered column chart to show my total expense by Area (attached) with a filter that allows the user to select which two (or more) periods to compare (in this example, comparing 2018 Q2 vs 2019 Q2).

 

I would like to add a line to my chart showing the % change between the two periods selected, but not sure how to build the measure since the periods analyzed will change with the filter. Example of my dataExample of my dataCurrent Bar ChartCurrent Bar Chart

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous - You'll need a disconnected Parameters table, like this:

Parameters = 
var periods = VALUES(YourTable[Period])
return CROSSJOIN(
    SELECTCOLUMNS(periods,"Period 1", [Period]),
    SELECTCOLUMNS(periods,"Period 2", [Period])
)

Then, you can add the measure like this:

Period 2 % of Period 1 = 
var period1 = CALCULATE(
    SUM(YourTable[Expense]),
    TREATAS(VALUES(Parameters[Period 1]),YourTable[Period])
)
var period2 = CALCULATE(
    SUM(YourTable[Expense]),
    TREATAS(VALUES(Parameters[Period 2]),YourTable[Period])
)
return DIVIDE(period2,period1)

Finally, add Period 1 and Period 2 as slicers, and the new measure to the visual.

Hope this helps,

Nathan

 

 

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

In your question you state that the user can select 2 (or more) periods.  So if the user selects 3 periods, then how do you propose to calculate the % change?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Anonymous - You'll need a disconnected Parameters table, like this:

Parameters = 
var periods = VALUES(YourTable[Period])
return CROSSJOIN(
    SELECTCOLUMNS(periods,"Period 1", [Period]),
    SELECTCOLUMNS(periods,"Period 2", [Period])
)

Then, you can add the measure like this:

Period 2 % of Period 1 = 
var period1 = CALCULATE(
    SUM(YourTable[Expense]),
    TREATAS(VALUES(Parameters[Period 1]),YourTable[Period])
)
var period2 = CALCULATE(
    SUM(YourTable[Expense]),
    TREATAS(VALUES(Parameters[Period 2]),YourTable[Period])
)
return DIVIDE(period2,period1)

Finally, add Period 1 and Period 2 as slicers, and the new measure to the visual.

Hope this helps,

Nathan

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors