Forum Discussion
Compare 2 different dates dynamically
- Anonymous2 years ago
Hi rbraga ,
Unfortunately power bi desktop does not support two slicers filtering a matrix visual object together. You can create a date slicer that selects two dates and presents date 1 and date 2 as card visual objects.
We can create a date table.
date = CALENDAR(DATE(2023,3,1),DATE(2023,4,6))We can create measures.
Difference = var _a=CALCULATE(MAX('Table'[sales]),FILTER(ALLSELECTED('Table'),'Table'[date]=MINX(ALLSELECTED('date'),'date'[Date]) && 'Table'[type]=MAX('Table'[type]))) var _b=CALCULATE(MAX('Table'[sales]),FILTER(ALLSELECTED('Table'),'Table'[date]=MAXX(ALLSELECTED('date'),'date'[Date]) && 'Table'[type]=MAX('Table'[type]))) var _c=MINX(ALLSELECTED('date'),'date'[Date]) return IF(MAX('Table'[date])=_c,BLANK(),_b-_a)date1 = MINX(ALLSELECTED('date'),'date'[Date])date2 = MAXX(ALLSELECTED('date'),'date'[Date])If you would like to suggest feature improvements, you may vote the idea and comment here to improve this feature. It is a place for customers provide feedback about Microsoft Office products . What’s more, if a feedback is high voted there by other customers, it will be promising that Microsoft Product Team will take it into consideration when designing the next version in the future.
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 rbraga ,
Unfortunately power bi desktop does not support two slicers filtering a matrix visual object together. You can create a date slicer that selects two dates and presents date 1 and date 2 as card visual objects.
We can create a date table.
date = CALENDAR(DATE(2023,3,1),DATE(2023,4,6))
We can create measures.
Difference =
var _a=CALCULATE(MAX('Table'[sales]),FILTER(ALLSELECTED('Table'),'Table'[date]=MINX(ALLSELECTED('date'),'date'[Date]) && 'Table'[type]=MAX('Table'[type])))
var _b=CALCULATE(MAX('Table'[sales]),FILTER(ALLSELECTED('Table'),'Table'[date]=MAXX(ALLSELECTED('date'),'date'[Date]) && 'Table'[type]=MAX('Table'[type])))
var _c=MINX(ALLSELECTED('date'),'date'[Date])
return IF(MAX('Table'[date])=_c,BLANK(),_b-_a)date1 = MINX(ALLSELECTED('date'),'date'[Date])date2 = MAXX(ALLSELECTED('date'),'date'[Date])
If you would like to suggest feature improvements, you may vote the idea and comment here to improve this feature. It is a place for customers provide feedback about Microsoft Office products . What’s more, if a feedback is high voted there by other customers, it will be promising that Microsoft Product Team will take it into consideration when designing the next version in the future.
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.