The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi
I am trying to write some DAX to add 5 different measures together. However, I only want to add the measures, where their result is positive i.e. >0. Below are the 5 measures:
Solved! Go to Solution.
The most basic way would be to create variables, where there value is defined by an if statement and return the sum.
Measure =
var _m1 = if([Advocate Partner Count Change] > 0, [Advocate Partner Count Change], 0)
var _m2 = if([Engaged Count Change] > 0, [Engaged Count Change], 0)
var _m3 = if([Interested Count Change] > 0, [Interested Count Change], 0)
var _m4 = if([Neutral Count Change] > 0, [Neutral Count Change], 0)
var _m5 = if([No / Blank Count Change]>0, [No / Blank Count Change], 0)
return _m1+_m2+_m3+_m4+_m5
The most basic way would be to create variables, where there value is defined by an if statement and return the sum.
Measure =
var _m1 = if([Advocate Partner Count Change] > 0, [Advocate Partner Count Change], 0)
var _m2 = if([Engaged Count Change] > 0, [Engaged Count Change], 0)
var _m3 = if([Interested Count Change] > 0, [Interested Count Change], 0)
var _m4 = if([Neutral Count Change] > 0, [Neutral Count Change], 0)
var _m5 = if([No / Blank Count Change]>0, [No / Blank Count Change], 0)
return _m1+_m2+_m3+_m4+_m5
That's amazing thank you! I was trying to use VAR, as I had a feeling that was the route I needed, but I'm not familiar enough with the syntax yet. I'm making the jump from having marginally above average Excel skills, to Power BI and it seems to me to be where Excel meets simple programming language. Really appreciate you taking the time to answer. thank you.
User | Count |
---|---|
16 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |