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
jianlong
Resolver I
Resolver I

Help on two layers of filters for dax

Hi all, 
Please help to see if you have a better solution for this.   
For msp table, there are two columns client_label and servdt, each client will have 1 or more servdt. 
What I am hoping to do is to :
1) define a variable, let's say from 1-20, as msp_m;
2) find all the clients that have more servdt than msp_m. 
 
The problem is that the measure only works for 1, which gives me all the client counts.   If I choose >=2,  it gives me blank.
 
Any simple solution?  thanks. 
 
 
 
MSP_min_serv =
var msp_m = SELECTEDVALUE(_Min_MSP[Min_Service])
return
calculate(distinctcount(MSP[CLNT_LABEL]),filter(MSP,calculate(distinctcount(MSP[SERVDT]),GROUPBY(MSP,MSP[CLNT_LABEL]))>=msp_m))
1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

HI @jianlong 

 

MSP_min_serv =
VAR msp_m =
    SELECTEDVALUE ( _Min_MSP[Min_Service] )
VAR _T =
    SUMMARIZE ( MSP, MSP[CLNT_LABEL], "SER", COUNTA ( MSP[SERVDT] ) )
VAR _A =
    FILTER ( _T, [SER] > msp_m )
RETURN
    COUNTROWS ( _A )

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

2 REPLIES 2
jianlong
Resolver I
Resolver I

Thank you very much for your help, this works well.  I wonder if you can share the reason why mine dax does not work?

VahidDM
Super User
Super User

HI @jianlong 

 

MSP_min_serv =
VAR msp_m =
    SELECTEDVALUE ( _Min_MSP[Min_Service] )
VAR _T =
    SUMMARIZE ( MSP, MSP[CLNT_LABEL], "SER", COUNTA ( MSP[SERVDT] ) )
VAR _A =
    FILTER ( _T, [SER] > msp_m )
RETURN
    COUNTROWS ( _A )

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

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.