March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
This measure gives me the difference between two estimates, and was generated by power bi desktop quick measures.
For now I have two estimates but soon I have 3 and more and I want this measure to always look at the two filtered estimates and calculate the difference.
Solved! Go to Solution.
I am clearly a n00b, I did everything wrong turned off my brain. I added the Estimate version column to the matrix and that was ofcourse not usable. removing that and creating two measures with the min/max function and then subtract, did the trick. Tx for the help
Estimat1 =
Var MaxDate = MAX ( 'FactEstimat'[Estimat version] )
RETURN
CALCULATE (
SUM ( FactEstimat[#Estimat] ),
FILTER (
FactEstimat,
(
FactEstimat[Estimat version] = MaxDate
)
),
ALL ( DimDato )
)
I am clearly a n00b, I did everything wrong turned off my brain. I added the Estimate version column to the matrix and that was ofcourse not usable. removing that and creating two measures with the min/max function and then subtract, did the trick. Tx for the help
Estimat1 =
Var MaxDate = MAX ( 'FactEstimat'[Estimat version] )
RETURN
CALCULATE (
SUM ( FactEstimat[#Estimat] ),
FILTER (
FactEstimat,
(
FactEstimat[Estimat version] = MaxDate
)
),
ALL ( DimDato )
)
hi @Bokazoit
it depends but you can try this technique
Estimat difference =
var __prevVersion = CALCULATE ( MIN ( 'FactEstimat'[Estimat version] ) )
VAR __BASELINE_VALUE =
CALCULATE(
[Estimat værdi],
'FactEstimat'[Estimat version] = __prevVersion
)
VAR __MEASURE_VALUE = [Estimat værdi]
RETURN
__MEASURE_VALUE - __BASELINE_VALUE
or
Estimat difference =
var __curVersion
var __prevVersion = CALCULATE ( MAX ( 'FactEstimat'[Estimat version] ), 'FactEstimat'[Estimat version] < __curVersion )
VAR __BASELINE_VALUE =
CALCULATE(
[Estimat værdi],
'FactEstimat'[Estimat version] = __prevVersion
)
VAR __MEASURE_VALUE = [Estimat værdi]
RETURN
__MEASURE_VALUE - __BASELINE_VALUE
Number 1 did not do the trick
And something is wrong with the second suggestion
Hi, @Bokazoit
Try formula as below:
Estimat difference =
VAR _FIRST_VERSION =
MAX ( FactEstimat[Estimat version] )
VAR _SECOND_VERSION =
MIN ( FactEstimat[Estimat version] )
VAR __FIRST_VALUE =
CALCULATE ( [Estimat værdi], 'FactEstimat'[Estimat version] = _FIRST_VERSION )
VAR __SECOND_VALUE =
CALCULATE ( [Estimat værdi], 'FactEstimat'[Estimat version] = _SECOND_VERSION )
RETURN
__FIRST_VALUE - __SECOND_VALUE
Check my sample file for more details.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
85 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |