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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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