Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
vivaldii
New Member

How can I compare dates selected from two separate slicers?

Hi,

And I need change percentage also number of changes

vivaldii_1-1710583656123.png

 

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

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.

danextian_0-1710645594698.png

 

Please see sample pbix for reference.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

6 REPLIES 6
v-zhouwen-msft
Community Support
Community Support

Hi @samratpbi , @danextian ,thanks for the quick reply, I'll add more.

Hi @vivaldii ,

The Table data is shown below:

vzhouwenmsft_0-1710831213951.png

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))

vzhouwenmsft_1-1710831278656.png

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

vzhouwenmsft_2-1710831388853.png

vzhouwenmsft_3-1710831395886.png

 

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.

vivaldii_1-1710922314947.png

 

 

danextian
Super User
Super User

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.

danextian_0-1710645594698.png

 

Please see sample pbix for reference.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

It's works. thanks.

samratpbi
Solution Supplier
Solution Supplier

You may create 2 different instances of date table and join with your main / fact table. And then put slicer based from those 2 different date tables and also create 2 set of count measures based on 2 date tables.

If this resolves your problem, then please mark it as Solution, thanks!

Hi, it didn't work. 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.