Forum Discussion
Calculate sum depending on slicer
Hi
I want to calculate a sum of a value depending on the lowest and highest value chosen on a slicer.
The slicer is showing all dates from 2019 and when i pick e.g. 16/03/2019 i want a meassure that sums the revenue for that day.
My data is sorted like this:
| Date | Customer | Revenue |
| 01-01-2019 | A | 1682 |
| 01-01-2019 | B | 4021 |
| 02-01-2019 | A | 1130 |
| 02-01-2019 | B | 2706 |
| … | ||
| 18-11-2019 | A | 2264 |
| 18-11-2019 | B | 2091 |
So if i on my slicer chose 02-01-2019 as the lowest date and 18-11-2019 as my highest date i would like two meassures.
Revenue for lowest date: 1.682 + 4.021 = 5.703
Revenue for higest date: 2.264 + 2.091 = 4.355
The end result is that i need to calculate the difference between theese two meassures
- Anonymous6 years ago
Hi Anonymous ,
Cerate two different measure to calculate Lowest date revenue and Highest Date revenue as like below,Revenue_Highest =VAR Maximum_date = MAX('Table'[Date])RETURNCALCULATE(SUM('Table'[Revenue]),'Table'[Date]=Maximum_date)Revenue_Lowest =VAR Minimum_date = MIN('Table'[Date])RETURNCALCULATE(SUM('Table'[Revenue]),'Table'[Date]=Minimum_date)It will wor as you expected, find the below screen shot FYR.
Dateset:Selection From Jan 1st to Nov-18:Selection From Jan 26th to Nov-18:
Best Regards,
Mail2inba4
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- AnonymousNot applicable
Hi Anonymous ,
Cerate two different measure to calculate Lowest date revenue and Highest Date revenue as like below,Revenue_Highest =VAR Maximum_date = MAX('Table'[Date])RETURNCALCULATE(SUM('Table'[Revenue]),'Table'[Date]=Maximum_date)Revenue_Lowest =VAR Minimum_date = MIN('Table'[Date])RETURNCALCULATE(SUM('Table'[Revenue]),'Table'[Date]=Minimum_date)It will wor as you expected, find the below screen shot FYR.
Dateset:Selection From Jan 1st to Nov-18:Selection From Jan 26th to Nov-18:
Best Regards,
Mail2inba4
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Thank you very much! It worked perfectly!