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
thomaslee3
New Member

Referencing a measure within a measure

Hi,

 

I have a table that tracks Non-Active Users (anyone that hasn't logged in more than 3 times within a specific date range)

I have a measure that counts the number of times an employee logs in. (SF Login Count)

SF Login Count = 

Var LoginCount = CALCULATE(DISTINCTCOUNT('Login History'[Login Date]),'Login History'[Status] = "Success")
return if(isblank(loginCount),0,logincount)

 

I want to create cards that counts the total number of users with 0 logins, 1 logins, 2 logins and 3 logins.

 

The formula I have for the 0 logins counter is: 

0 Counter =
if(
calculate( DISTINCTCOUNT('Login History'[Login Date]), 'Login History'[Status] = "Success") = 0,DISTINCTCOUNT(Login[Login Date]),"Null")
 
Is there a way to do a countif like calculation of the SF Login Count column in the table?
 
PBI.PNG
1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @thomaslee3 ,

Do you want visuals below? 

refer.PNG

If so, you can create a new calculated table like so:

Table =
VAR t =
    SUMMARIZE (
        'Login History',
        'Login History'[Name],
        "SF_Login_Count", [SF Login Count]
    )
RETURN
    SUMMARIZE (
        t,
        [SF_Login_Count],
        "Counter", COUNTX ( FILTER ( t, [SF_Login_Count] = EARLIER ( [SF_Login_Count] ) ), [Name] )
    )

This is my PBIX file.

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
Icey
Community Support
Community Support

Hi @thomaslee3 ,

Do you want visuals below? 

refer.PNG

If so, you can create a new calculated table like so:

Table =
VAR t =
    SUMMARIZE (
        'Login History',
        'Login History'[Name],
        "SF_Login_Count", [SF Login Count]
    )
RETURN
    SUMMARIZE (
        t,
        [SF_Login_Count],
        "Counter", COUNTX ( FILTER ( t, [SF_Login_Count] = EARLIER ( [SF_Login_Count] ) ), [Name] )
    )

This is my PBIX file.

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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.