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
MaxW
Advocate II
Advocate II

Dax challenge! Category based on trend

Hi,

 

Bit of a DAX challenge here (or suggest a better alternative).

I have a list of users and timestamps when they have logged in. I also have a calendar table. I want to split these users into four categories:

No usage

Steady Usage
Decreasing Usage

Increasing Usage

The split should be based on the trend of # of weekly logins in the last three months.  

Help much appreciated!

1 REPLY 1
MFelix
Super User
Super User

Hi @MaxW,

 

Not sure how you have the setup of your data and how you are calculating the 4 levels of usage but I have made this setup:

 

  • Table DimDate
  • Table TimeStamp (User + Login Date)
  • Table Users

 

  • Created two measure with the following formula:

 

 

Usage =
VAR Usage_user =
    COUNT ( TimeStamps[User] )
RETURN
    CALCULATE ( IF ( Usage_user = BLANK (); 0; Usage_user ) )



Usage text =
SWITCH (
    TRUE ();
    [Usage] = 0; "No Usage";
    [Usage] <= 3; "Decreasing Usage";
    [Usage] <= 5; "Steady Usage";
    "Increasing USage"
)

 

Then just add them to your visuals:

 

usage.png

 

My data only has information for the 3 month but if you need the formulas can be adjusted to get the 3 months as you need, just tell me how are you calculating the 3 month back is it from current date or selected from a slicer, also you need to define how you are considering the increasing decreasing values.

 

Regards,

MFelix

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.