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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
trailblazer2022
New Member

Dynamic Baseline for Percentage Difference

Hi, I have the following formula:

 

 

Revenue % difference from 1H 2019 = 
VAR __BASELINE_VALUE =
  CALCULATE(
    [Revenue],
    'Revenue by Product'[Period] IN { "1H 2019" },
    ALL('Revenue by Product'[Period ID])
  )
VAR __MEASURE_VALUE = [Revenue]
RETURN
  IF(
    NOT ISBLANK(__MEASURE_VALUE),
    DIVIDE(__MEASURE_VALUE - __BASELINE_VALUE, __BASELINE_VALUE)
  )

 

 

I would like to make the _BASELINE VALUE dynamic i.e. changing "1H 2019" to "2H 2019" to "1H 2020" and so on. The period has a corresponding period ID i.e. 1H 2019 = 1, 2H 2019 = 2 and so on. 

 

Is it possible as I want to calculate the percentage difference between two consecutive bars i.e. 1H 2019 and 2H 2019, 2H 2019 and 1H 2020 and so on. Appreciate any help please!

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

Hi @trailblazer2022 ,

 

You will need a dim table like below:

column1   column2

1H 2019    1

2H 2019    2

1H 2020    3

2H 2020    4

Then use column1 as x-axis and replace { "1H 2019" } to selectedvalue([ column2])+1/-1

 

Best Regards,

Jay

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @trailblazer2022 ,

 

You will need a dim table like below:

column1   column2

1H 2019    1

2H 2019    2

1H 2020    3

2H 2020    4

Then use column1 as x-axis and replace { "1H 2019" } to selectedvalue([ column2])+1/-1

 

Best Regards,

Jay

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
lbendlin
Super User
Super User

You are describing the basic feature of filter context.  

 

Please provide sanitized sample data that fully covers your issue.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.