Forum Discussion
calculate variance between two dates based on two values
- Anonymous3 years ago
Hi taylorie ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create a measure.
Variance = var a=MINX(FILTER(ALL('Table (2)'),[Corporate ref]=MAX('Table'[Corporate ref])&&[Date]>=MAX('Table'[Bsc start])),[Date]) var b=CALCULATE(SUM('Table (2)'[Daily sale]),'Table (2)'[Date]=a) return ABS(CALCULATE(SUM('Table (2)'[Daily sale]),'Table (2)'[Date]=a+1)-b)(3) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi taylorie ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create a measure.
Variance =
var a=MINX(FILTER(ALL('Table (2)'),[Corporate ref]=MAX('Table'[Corporate ref])&&[Date]>=MAX('Table'[Bsc start])),[Date])
var b=CALCULATE(SUM('Table (2)'[Daily sale]),'Table (2)'[Date]=a)
return ABS(CALCULATE(SUM('Table (2)'[Daily sale]),'Table (2)'[Date]=a+1)-b)
(3) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous Hi and thank you, I have applied the measure to my data but I noticed the COM date is not acounted for in this. I have cheched the data but its not working. see below from my tables.
This is the result
This are the actual data from the database
I think I maybe missing something?
Thank you!
- Anonymous3 years agoNot applicable
Hi taylorie ,
Please try changing the column about dates to the same format. Please check the data model as shown in the following figure. If that doesn't help, can you provide a PBIX file (take care to protect your data privacy).
Best Regards,
Neeko Tang