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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
deuscreator
Frequent Visitor

Generate daily values from date range

Hey guys, I need help with this:

I have data that looks like this:

 

Date                     ID          Status

2019.01.15           USER1   NEW

2019.01.30           USER1   REGISTERED

2018.11.17           USER2   NEW

2019.01.18           USER2   REGISTERED

2019.01.19           USER3   NEW

2019.01.26           USER3   REGISTERED

2019.01.30           USER3   ACTIVE

2019.03.22           USER3   SUSPENDED

2019.03.24           USER3   ACTIVE

2019.01.24           USER1   ACTIVE

2019.01.25           USER4   NEW

2019.02.26           USER1   SUSPENDED

2019.04.21           USER3   SUSPENDED

What I'd like is a daily account of all users existing by that date with their status, something like this (not counted from the data above, just for example):

Date                     ID          Status

2019.01.01           USER1   NEW

2019.01.01           USER2   NEW

2019.01.02           USER2   REGISTERED

2019.01.02           USER1   REGISTERED

2019.01.02           USER3   NEW

2019.01.03           USER3   REGISTERED

2019.01.03           USER1   ACTIVE

2019.01.03           USER4   NEW

2019.01.03           USER2   SUSPENDED

 

I'd ideally do this in DAX, also ideally for just the last 1 month (there is a daily refresh in the database).  I started creating a calendar table for the desired time period and do a join, but it won't work the way intended.

Any ideas? Many thanks in advance!

1 REPLY 1
Anonymous
Not applicable

With your Calendar Table related to your Fact Table, use the Date column from the Calendar Table on rows and ID from your Fact table on columns. Then use the following measure:

Status = 
VAR __LastMonth = EDATE( TODAY(), -1 )
RETURN

IF(
   AND( 
       MAX( DimCalendar[Date]) >= __LastMonth,
        HASONEVALUE( Table1[Status]) && HASONEVALUE( DimCalendar[Date])),
         VALUES( Table1[Status] ))

Will only show statuses and associated ID's that have occured within the last month from the current date:

 

Final table ( I added another record for april to make sure it was working correctly)

Has One Values for Last Month.png

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.