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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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