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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
CAPSTALKER
Helper I
Helper I

Distinct values of a column with filttering by another column

Hi all, 

 

I'm new to Power BI and DAX, so thanks in advance for helping. 

 

I have a table named RUM: 

emaildate
crash@test.com2020-08-26
crash@test.com2020-08-27
test@dummy.com2020-08-27
test@dummy.com2020-08-27

dummy@dotcom.com

2020-10-10

dummy@dotcom.com

2020-10-10

kim@dot.com

2020-01-01

 

I need to get number of distinct dates for each email address while at same time filttering some of emails. 

From the table above result should be:

emailunique dates
crash@test.com2
test@dummy.com1

 

I have following DAX but I'm not totally sure if it gives the right kind of result. 

 

unique dates = 

  CALCULATE(

           DISTINCTCOUNT(RUM[date]),

           FILTER(

              RUM,

              RUM[email] <> "dummy@dotcom.com"  &&

              RUM[email] <> "kim@dot.com"

           )

)

 

I know there are multiple ways to do this and would prefer the simplest. Any help and comments will be highly appreciated.

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@CAPSTALKER -

I do not see any issue with what you have in your calculation. Another way to do it is:

unique dates =
  COUNTROWS(
    DISTINCT(
      SELECTCOLUMNS(
        FILTER(RUM,RUM[email]<>"dummy@dotcom.com" && RUM[email]<>"kim@dot.com"),
        "date",[date]
      )
    )
  )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@CAPSTALKER , Try like

unique dates =   CALCULATE(
           DISTINCTCOUNT(RUM[date]),
           FILTER(RUM, not( RUM[email] in {"dummy@dotcom.com"  , "kim@dot.com" })))		
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

@CAPSTALKER -

I do not see any issue with what you have in your calculation. Another way to do it is:

unique dates =
  COUNTROWS(
    DISTINCT(
      SELECTCOLUMNS(
        FILTER(RUM,RUM[email]<>"dummy@dotcom.com" && RUM[email]<>"kim@dot.com"),
        "date",[date]
      )
    )
  )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.