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
Hi
I have two tables as per below, I need to calculate the difference between "daily sales" before and after the "Service" was done, using "Bsc Start" and "COM date". The only constant in both tables is the "Corporate ref", and for every date I have a "Daily sale" figure.
eg. I would need to say the Daily sale difference between Bsc Strat and COM date for the Service TA10, Corporate Ref z765 is xxx
I have tried a couple of options but its not working, I have 2 years worth of daily data and the Corporate Ref are repeating multiple times, same as Service.
Can you please help me add this column?
Thanks
Solved! Go to Solution.
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.
@v-tangjie-msft 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!
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
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 |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
21 | |
16 | |
14 |