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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
samsa18
Frequent Visitor

How to use conditionals on filter expression?

 

Hi all,

 

I'm trying to count the unique ids based on the 90 day amount. However, one problem I ran to is that it would count the 120 day amount, which is not what I want and highlighted in blue.  I'm still new to BI, so I'm not sure what syntax/formatting to use to tell my function to ignore those columns. 

 

Here's the measure I used:  

Unique Count Measure = CALCULATE(DISTINCTCOUNT('PSJH DQ 9-13-2022'[ID]), FILTER('PSJH DQ 9-13-2022',('PSJH DQ 9-13-2022'[Day 90 Amount])))

 

samsa18_1-1663361974422.png

 

1 ACCEPTED SOLUTION

Hi,

Try this

=calculate(distinctcount('PSJH DQ 9-13-2022'[ID]),'PSJH DQ 9-13-2022'[Day 90 Amount]>0&&'PSJH DQ 9-13-2022'[Day 120 Amount]=0)


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @samsa18 ,

You can try adding ALL() or ALLSELECT() to the formula:

Unique Count Measure=
CALCULATE(DISTINCTCOUNT('PSJH DQ 9-13-2022'[ID]),FILTER(ALL('PSJH DQ 9-13-2022'),'PSJH DQ 9-13-2022'[Day 90 Amount]))
Unique Count Measure =
CALCULATE(DISTINCTCOUNT('PSJH DQ 9-13-2022'[ID]),FILTER(ALLSELECTED('PSJH DQ 9-13-2022'),'PSJH DQ 9-13-2022'[Day 90 Amount]))

 

Refer to:

ALL function (DAX) - DAX | Microsoft Learn

ALLSELECTED function (DAX) - DAX | Microsoft Learn

 

Best Regards,

Liu Yang

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

Ashish_Mathur
Super User
Super User

Hi,

If Day 90 amonut is already a measure that you have written, then write this measure

Distinct count = countrows(filter(values('PSJH DQ 9-13-2022'[ID]),[Day 90 Amount]>0))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

It's not a measure. It's part of the data source.

Hi,

Try this

=calculate(distinctcount('PSJH DQ 9-13-2022'[ID]),'PSJH DQ 9-13-2022'[Day 90 Amount]>0&&'PSJH DQ 9-13-2022'[Day 120 Amount]=0)


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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