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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Date Slicer

Hi, 

 

How to add date slicer and get dynamic count of ID's?

 

tbl1

ID       timestamp                               

1           28/09/2020 11:14              

1           29/09/2020 11:14

1          30/09/2020 11:14 

1          1/10/2020 11:14

1           3/10/2020 11:14

1          5/10/2020 11:14

tab2:

 Used  DAX formulas to calculate min and max:

 

ID             min_date         Max_date           TotalLogin

1                28/09/2020     05/10/2020           6

     

Using date slicer if I select min_date =3/10/2020 and max_date = 5/10/2020 . My Total login should be 2.

The total logins are not count of dates but count of Id's.

Time can be ignored for now.

 

Thank you for helping with DAX.

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hello @md264092 , is Table 2 your expected result? If so, you can follow the steps below for the reference.

First, add a new Date column to Table 1.

Date = Tbl1[timestamp]. [Date]

v-jingzhang_0-1602136372446.png

Next, create the following measures:

Max_date = MAX(Tbl1[Date])

Min_date = MIN(Tbl1[Date])

TotalLogin = COUNT(Tbl1[ID])

Finally, place the Date column in a slicer, place IDs, and three previous measures in a table visual. Now, when you change the maximum and minimum date in the slicer, the data in the table will change accordingly.

v-jingzhang_1-1602136372450.jpeg

Best regards

Community Support Team _ Jing Zhang

If this post helps,please consider Accepting it as the solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hello @md264092 , is Table 2 your expected result? If so, you can follow the steps below for the reference.

First, add a new Date column to Table 1.

Date = Tbl1[timestamp]. [Date]

v-jingzhang_0-1602136372446.png

Next, create the following measures:

Max_date = MAX(Tbl1[Date])

Min_date = MIN(Tbl1[Date])

TotalLogin = COUNT(Tbl1[ID])

Finally, place the Date column in a slicer, place IDs, and three previous measures in a table visual. Now, when you change the maximum and minimum date in the slicer, the data in the table will change accordingly.

v-jingzhang_1-1602136372450.jpeg

Best regards

Community Support Team _ Jing Zhang

If this post helps,please consider Accepting it as the solution to help other members find it.

Anonymous
Not applicable

Thank you Jing Zhang for your help.

It worked well!

amitchandak
Super User
Super User

@Anonymous ,

Create a date colum

 

Date = [timestamp].date

 

PNow you can this in slicer or join with date table use that in slicer.

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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