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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Collazo
New Member

How to Compare Dates in a Incremental Data Set?

Hi I'm trying to make a dynamic dashboard where the user could be able to choose 2 dates from 2 different slicers. 

 

I cannot give a model due to sensitivity but lets try to give a context

 

Source:

 

Output date  Project Name   Has Pendency

2022-08-20      Project A               Yes

2022-08-20      Project B                Yes

2022-08-20      Project C                Yes

2022-08-21      Project A                No

2022-08-21      Project B                Yes

2022-08-21      Project C                 Yes

2022-08-21      Project D                No

2022-08-22      Project A                Yes

2022-08-22      Project B                 Yes

2022-08-22      Project C                Yes

2022-08-22      Project D                No

 

My user should be able to select two date from 2 different slicers and make a comparison like (2022-08-20 my project counting was 3 and it's x less than other selected date).

 

I tried to do this with What If Parameter but there's no date type to select and I cannot have a blank field to user input a date since the user dont know the dates I have in the backend so needs to be a Dropdown list

 

Any clues?

 

Thank you so much in advance

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Collazo ,

 

I suggest you to create date tables by CALENDAR() or CALENDARAUTO() function.

Date 1 = 
CALENDAR(MIN('Table'[Output date]),MAX('Table'[Output date]))
Date 2 = 
CALENDAR(MIN('Table'[Output date]),MAX('Table'[Output date]))

Create unactive relationship between two date tables and your fact table.

RicoZhou_1-1661505739280.png

Measure 1 = 
CALCULATE(COUNT('Table'[Project Name]),USERELATIONSHIP('Date 1'[Date],'Table'[Output date]))
Measure 2 = 
CALCULATE(COUNT('Table'[Project Name]),USERELATIONSHIP('Date 2'[Date],'Table'[Output date]))
Diff = 
ABS([Measure 1] - [Measure 2])

Result is as below.

RicoZhou_2-1661506280590.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @Collazo ,

 

I suggest you to create date tables by CALENDAR() or CALENDARAUTO() function.

Date 1 = 
CALENDAR(MIN('Table'[Output date]),MAX('Table'[Output date]))
Date 2 = 
CALENDAR(MIN('Table'[Output date]),MAX('Table'[Output date]))

Create unactive relationship between two date tables and your fact table.

RicoZhou_1-1661505739280.png

Measure 1 = 
CALCULATE(COUNT('Table'[Project Name]),USERELATIONSHIP('Date 1'[Date],'Table'[Output date]))
Measure 2 = 
CALCULATE(COUNT('Table'[Project Name]),USERELATIONSHIP('Date 2'[Date],'Table'[Output date]))
Diff = 
ABS([Measure 1] - [Measure 2])

Result is as below.

RicoZhou_2-1661506280590.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Collazo , Refer if my video can help on this

 

How to use two Date/Period slicers

https://youtu.be/WSeZr_-MiTg

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.