Forum Discussion
DataFab2023
3 years agoFrequent Visitor
Calculation based on two dates
Hi guys, I have to calculate the sales on the scenario below: I have a dim_date filter that has no relationship with the sales table and I need to use that as slicer. Each sale has its ow...
- 3 years ago
Hi , DataFab2023
Thanks for your quick response!I may have a mistake in my dax code , you can try to use this dax:
Measure = var _slicer =MAX('Dim_Date2'[Date Filter]) var _start = MINX( FILTER(ALLSELECTED('Sheet1'),'Sheet1'[Date]=_slicer) , [Start]) var _date = MAX('Sheet1'[Date]) return IF(_date>=_start && _date<= _slicer,1,0)Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
bhelou
3 years agoResponsive Resident
Dear ,
Make the relationship from DIM_DATE to the Sheet1 Dates : 1 to many
Then in the sclicer make it as hierarchy and select only year and quarter :
Attached images
Kindly accept as a solution and a kudo would be greatfull .
Regards ,