CountIf on multiple DAX Measure

jdorby

New Member
Joined
Jul 28, 2014
Messages
22
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I'm not even sure if this is possible, but I'm going to see if anyone can help. The below table is in PowerPivot. I'm trying to find out how many Projects/Opportunities sold services across multiple business practices. The company has multiple business lines/practices and one opportunity/project can be composed of several business lines or practices.

In the example attached, Prac1, Prac2, Prac3, etc. are MEASURES -- I'd like to essentially do a countif and say if there are dollar values in more than one practice that means that opportunity had cross-practice sales and mark it as "1", otherwise mark it as "0". Is there a way to do something like a countif, but against a Measure?
Dax Question.png
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
It can certainly be done, but first I’m more interested in the 6 measures. What is that logic inside those measures?

I haven’t test it, but I think you could do either
Sumx(values(table[opportunity]),If(([measure 1]>0 + [measure 2]>0 + … etc)>1,1,0))
Or
Sumx(values(table[opportunity]),If((value([measure 1]>0)+ value( [measure 2]>0) + … etc)>1,1,0))

Make sure you get VALUES and VALUE exactly as written

Depending on the logic in the measures and the semantic model table structure, there may be a more efficient solution.
 
Upvote 0
Thank you so much for the response, Matt! I'm getting this error for both formulae
 

Attachments

  • Dax Error.png
    Dax Error.png
    6.8 KB · Views: 4
Upvote 0
Thank you so much for the response, Matt! I'm getting this error for both formulae
And my measures aren't anything special, just summing a column called Prac1:

=sum(Append1[Prac1])
 
Upvote 0
Sorry, my bad. I think somehow that DAX has changed over the years; I could be wrong. I'm thinking maybe an if statement that returns true if one or more measures are true. I don't have your data to test it, but try this.

=If([measure 1]>0 || [measure 2]>0 || [measure 3]>0 || [measure 4]>0 )>1,1,0))

I'm just not sure what will happen if there are 2 that are true.

Also, you should look at your data shape. if your formulas are
=sum(Append1[Prac1])
=sum(Append1[Prac2])
etc

Then your data is not optimal shape. Read about that here https://exceleratorbi.com.au/the-optimal-shape-for-power-pivot-data/
 
Upvote 0

Forum statistics

Threads
1,215,635
Messages
6,125,945
Members
449,275
Latest member
jacob_mcbride

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top