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
deuscreator
Frequent Visitor

Daily count of last statuses

Hey folks, 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 need is a daily account of all "last statuses". Meaning that I need to be able to tell that on any given day, how many ACTIVE, NEW, REGISTERED, SUSPENDED statuses were there (On any specific date, what was the last status of the users relative to that day, and then do a count).

 

I wonder if I need to write in all IDs to a table for all the days in the range (2 years and growing) or this can be done dynamically / easier. Later down the road, I will need monthly, quarterly summaries as well on the average values of the status counts.

 

Any simple way to do this? Much appreciated in advance!

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @deuscreator ,

If it is convenient, could you share your desired output so that we could understand your logic better and help further on it?

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hey Cherry,

 

Thank you for your reply!

 

Sure, basically, I would like to see the status of each user on each day (last recorded status looking back from that day), and the ability to calculate the aggregate count of the users by each status. 

 

The resulting, aggregated data would be something like this (not actually counted from my example):

 

Date                      NEW      REGISTERED       ACTIVE                 SUSPENDED

2019.02.12           2              3                              10                           5

2019.02.13           7             4                               9                             15

2019.02.14           1              5                              22                           7

 

Now, I don't really know whether this would be more practical in PowerQuery or DAX, and I wonder if I make aggregates like this in a separate table, how could I retain the ability to filter still by the user ID (there are many other fact tables that are connected via the user ID). The aim is to create daily snapshots of the whole user base, based on the history of their status changes.

Is it any clearer?

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.