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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
dolevh
Helper II
Helper II

Filters with Distinct Count

Total Revenue per Month 3 Table
ydCodeBlocker Boolean numydDeptNameStartofMonth
1231Electrics1/1/21
1231Electrics1/2/21
1231Electrics1/3/21
1231Electrics1/4/21
1231Electrics1/5/21
3210Hybrid1/1/21
3210Hybrid1/2/21
3210Hybrid1/3/21
3210Hybrid1/4/21
3210Hybrid1/5/21
5551Gasoline1/1/21
5551Gasoline1/2/21
5551Gasoline1/3/21
4441Hybrid1/1/21
4441Hybrid1/2/21
4441Hybrid1/3/21

 

 

 

Measure =
CALCULATE (
DISTINCTCOUNT ('Total Revenue per Month 3 Table'[ydCode]),
FILTER(
ALL(
'Total Revenue per Month 3 Table','Total Revenue per Month 3 Table'[Blocker boolean num]),
'Total Revenue per Month 3 Table'[Blocker boolean num] = "1"),
FILTER(
ALL('Total Revenue per Month 3 Table'[ydDeptName]),
'Total Revenue per Month 3 Table'[ydDeptName] <> "Gasoline")) 

 

 

 

Does someone know why it's not working?
 
1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @dolevh 

 

If you are looking for a measure to count the number of ydCode values based on the filters ([Blocker boolean num] = 1 and [ydDeptName] <> "Gasoline"), and 2 as a result, try this measure:

 

Measure = 
CALCULATE (
    DISTINCTCOUNT ( 'Total Revenue per Month 3 Table'[ydCode] ),
    FILTER (
        ALL ( 'Total Revenue per Month 3 Table' ),
        'Total Revenue per Month 3 Table'[Blocker boolean num] = 1
            && 'Total Revenue per Month 3 Table'[ydDeptName] <> "Gasoline"
    )
)

 

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

4 REPLIES 4
v-yanjiang-msft
Community Support
Community Support

Hi @dolevh ,

According to your description, here’s my solution.

  1. Create a measure.

Measure = IF(MAX([Blocker boolean num])=1&&MAX([ydDeptName])<>"Gasoline"&&MONTH(MAX('Table'[StartofMonth]))=1,"1","0")

2.Put the measure into filter, and then select 1.

vkalyjmsft_0-1636940350331.png

 

Best Regards,
Community Support Team _ kalyj

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

VahidDM
Super User
Super User

Hi @dolevh 

 

If you are looking for a measure to count the number of ydCode values based on the filters ([Blocker boolean num] = 1 and [ydDeptName] <> "Gasoline"), and 2 as a result, try this measure:

 

Measure = 
CALCULATE (
    DISTINCTCOUNT ( 'Total Revenue per Month 3 Table'[ydCode] ),
    FILTER (
        ALL ( 'Total Revenue per Month 3 Table' ),
        'Total Revenue per Month 3 Table'[Blocker boolean num] = 1
            && 'Total Revenue per Month 3 Table'[ydDeptName] <> "Gasoline"
    )
)

 

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/

 

 

Greg_Deckler
Community Champion
Community Champion

@dolevh What is the end result you are trying to achieve? As in, what would be your expected result from the sample data?



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

ydCodeBlocker Boolean numydDeptNameStartofMonth
1231Electrics1/1/21
4441Hybrid1/1/21

@Greg_Deckler 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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