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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ab_99
Frequent Visitor

Divide one value by reference value in a matrix (trend calculation)

Hi dear Power BI Community,

 

I have this following issue: 

I have a matrix with years in rows and months in columns.

ab_99_0-1725979746708.png

Now I want to perform a trend calculation as follows:

Value from 2023-1 (1.834) is for all following periods the reference value (the value from the earliest month and year basically). I need to devide each value from the other months by the reference value. 

E.g.:

2024-02:     2.618/1.834

2023-04:     12.498/1.834

and so on. 

 

How can I achieve this with a measure?

 

Thanks in advance!

1 ACCEPTED SOLUTION

would you try this solution:

var min_date= calculate(min(date), allselected(table))

var ref = CALCULATE(max(X), filter(ALLSELECTED(table), [date] = min_date)

return

divide ( selectedvalue( X) , ref)

 ** X is the column that contain tehse values **

 

if still not working, please provide some details about your tables, model and relationships.

View solution in original post

6 REPLIES 6
Selva-Salimi
Solution Specialist
Solution Specialist

Hi @ab_99 

 

Is it a fixed value for all month and all years?! if so, then you can write a measure as follows:

 

measure rate :=

var ref = calculate (max(X) , filter (all(table) , year(date)= 2023 && month (date) =1))

return

divide ( selectedvalue( X) , ref)

 ** X is the column that contain tehse values **

 

If this post helps, then I would appreciate a thumbs up 👍  and mark it as the solution to help the other members find it more quickly. 

Hi @Selva-Salimi 

 

thank you for your quick reply.

The month and year isn't fixed. I have a between-slicer where I select the year-frame I'd like to see. 
The value has to be variable and must come from the first month of the earliest year selected.

ok, then you can rewrite as follows:

var ref = CALCULATE(max(X), filter(ALLSELECTED(table), [date] = min (date))

return

divide ( selectedvalue( X) , ref)

 ** X is the column that contain tehse values **

 

 

If this post helps, then I would appreciate a thumbs up and mark it as the solution to help the other members find it more quickly. 

Unfortunately, it is not working. I put only the ref variable in a measure and this is the result: 

ab_99_0-1725982825828.png

The result should be everywhere 1.834, if this dax expression works.

would you try this solution:

var min_date= calculate(min(date), allselected(table))

var ref = CALCULATE(max(X), filter(ALLSELECTED(table), [date] = min_date)

return

divide ( selectedvalue( X) , ref)

 ** X is the column that contain tehse values **

 

if still not working, please provide some details about your tables, model and relationships.

Thank you very much! That did the job. 🙂

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.