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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
power_roboter
Frequent Visitor

filter subset of same table based on not in filter

Hi,

 

I am looking for the correct dax syntax to get all users in my table who have the licenceType = "demo" && userRole= "customer" and at the same time do not have the licenceType = "full" && userRole= "customer". As a result I want to get a distinctcount of the users who only have the licenceType = "demo" and not licenceType = "full". I'm looking forward to your help...

 

 

| userId | userRole | licenceType | date | action

| a | customer | demo | 21.12.2019 | action

| a | customer | full | 22.12.2019 | action

| b | customer | demo | 22.12.2019 | action

| c | customer | demo | 22.12.2019 | action

| c | customer | full | 29.12.2019 | action

 

The result based on this sample should be 1.

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Here is a rough version.  May need some context refinement.

 

OnlyDemo = 
var fulls = SELECTCOLUMNS(CALCULATETABLE('Table','Table'[licenceType ]="full"),"id",'Table'[userId ])
var demos = SELECTCOLUMNS(CALCULATETABLE('Table','Table'[licenceType ]="demo"),"id",'Table'[userId ])
return countrows(except(demos,fulls))

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

Here is a rough version.  May need some context refinement.

 

OnlyDemo = 
var fulls = SELECTCOLUMNS(CALCULATETABLE('Table','Table'[licenceType ]="full"),"id",'Table'[userId ])
var demos = SELECTCOLUMNS(CALCULATETABLE('Table','Table'[licenceType ]="demo"),"id",'Table'[userId ])
return countrows(except(demos,fulls))

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.