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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
RPATER
Frequent Visitor

CALCULATE(DISTINCTCOUNT( when using a created if measure

Hi All,

 

I am currently trying to create a card that counts the distinct number of campaigns after two filters are applied to a large table.  The first filter is that column(wave) = 1 and the second is that a measure I created:

"Risk"

IF ( SELECTEDVALUE ( Query1[Wave] ) = 1 && [Delivery_Rate] < .85, 1, 0 )

 

Needs to equal 1.  The final result should be a count of 2 but I either get 19(total number of unique campaigns in the table) or the following error:

"A Function 'Calculate' has been used in a True/False expression that is used as a table filter expression. This is not allowed."

 

I understand that the error is coming from the "Risk" measure but I am not sure of a way around that to get my solution.  Any suggestions would help greatly!

 

Thank You,

Ryan

 

DAX attempts:

1. distinct campaigns = CALCULATE(DISTINCTCOUNT(Query1[CampaignName]),[Risk2]=1, Query1[Wave]=1)
 
2. distinct campaigns = CALCULATE(DISTINCTCOUNT(Query1[CampaignName]),
FILTER(query1,Query1[Wave]=1 && [Delivery_Rate]<.85))
 

Example data:

ClientIdCampaignNameAssetNameRisk
1Campaign1Asset11
2Campaign2Asset21
3Campaign3Asset30
4Campaign4Asset40
1Campaign5Asset50
1Campaign6Asset60
1Campaign7Asset70
1Campaign8Asset80
2Campaign9Asset90
2Campaign10Asset100
2Campaign11Asset110
2Campaign12Asset120
2Campaign13Asset130
2Campaign14Asset140
5Campaign15Asset150
5Campaign16Asset160
5Campaign17Asset170
5Campaign18Asset180
6Campaign19Asset190
1 REPLY 1
lbendlin
Super User
Super User

PLease add the wave column to your sample data.

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

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