Forum Discussion
Divide one value by reference value in a matrix (trend calculation)
- 2 years ago
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.
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.
- Selva-Salimi2 years ago
Solution Sage
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.
- ab_992 years agoFrequent Visitor
Unfortunately, it is not working. I put only the ref variable in a measure and this is the result:
The result should be everywhere 1.834, if this dax expression works.
- Selva-Salimi2 years ago
Solution Sage
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.