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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors