Forum Discussion
How can I compare dates selected from two separate slicers?
- 2 years ago
Hi vivaldii ,
You need a separate dates table that doesn't have relationship to your fact You can create one in DAX by referencing the original Dates table
Dates2 = Original_Date.
Please see sample pbix for reference.
Hi samratpbi , danextian ,thanks for the quick reply, I'll add more.
Hi vivaldii ,
The Table data is shown below:
Please follow these steps:
1. Use the following DAX expression to create a table named ‘Table2’
Table 2 = CALENDAR(DATE(2024,1,1),DATE(2024,12,31))
2. Use the following DAX expression to create a table named ‘Table3’
Table 3 = CALENDAR(DATE(2024,1,1),DATE(2024,12,31))
3. Use the following DAX expression to create a measure
Measure = CALCULATE( SUMX(FILTER('Table','Table'[Date] = SELECTEDVALUE('Table 2'[Date])),[Number]),ALL('Table 3'[Date]))
4. Use the following DAX expression to create a measure
Measure 2 = CALCULATE( SUMX(FILTER('Table','Table'[Date] = SELECTEDVALUE('Table 3'[Date])),[Number]),ALL('Table 2'[Date]))
5. Use the following DAX expression to create a measure
Measure 3 = [Measure 2] - [Measure]
6. Use the following DAX expression to create a measure
Measure 4 = DIVIDE([Measure 3],[Measure 2])
7. Final output
Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Thanks a lot. I tried but, I don't have data like your "Table" example.
I need before date to selected. Not only one month period.
<= selected value
Measure = CALCULATE( SUMX(FILTER('İlgili Kişi','İlgili Kişi'[Oluşturma Tarihi] <= SELECTEDVALUE('Başlangıç Tarihi'[Date])),[Gönüllü Sayısı Toplam]),ALL('Bitiş Tarihi'[Date]))
but it doesn't work.