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.
Hi All,
I have below requirement to calculate measure on basis of indicator values to maintain masking scenarios.
The measure is as follows.
Mesaure =
var A=selectedvalue(table[IND1])
var B=selectedvalue(table[IND2])
var C= ISFILTERED(table[Function] )
var D= ISFILTERED(table[Cost_Type] )
var E=SWITCH( true(),
A="1" && B="3" ,CALCULATE(SUM(table[sale_value])),
A="1" && B="4" && NOT C,CALCULATE(SUM(table[sale_value])),
A="2" && B="5" && NOT D,CALCULATE(SUM(table[sale_value])),
BLANK())*0.000001
return E
The table column IND_1 is having values 1,2
IND-2 is having 3,4,5
But the variables are not working as expected.Giving blank values.
Solved! Go to Solution.
Hi @Anonymous ,
Mesaure1 =
VAR A = SELECTEDVALUE('table'[IND_1])
VAR B = SELECTEDVALUE('table'[IND_2])
// Since the [Function] column and the [cost_level] column are from the same table, when [Function] is filtered, [cost_level] is also filtered.
VAR C = ISFILTERED('table'[Function])
RETURN
SWITCH(
TRUE(),
// [IND_1], [IND_2] and [sale_value] is numeric type data.
A = 1 && B = 3, SUM('table'[sale_value]),
A = 1 && B = 4 && NOT(C), SUM('table'[sale_value]),
A = 2 && B = 5 && NOT(C), SUM('table'[sale_value]),
BLANK()
) * 0.000001
I think the logic of your formula is a bit strange, if this is not what you want, you can describe what kind of effect you want to get.
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Mesaure1 =
VAR A = SELECTEDVALUE('table'[IND_1])
VAR B = SELECTEDVALUE('table'[IND_2])
// Since the [Function] column and the [cost_level] column are from the same table, when [Function] is filtered, [cost_level] is also filtered.
VAR C = ISFILTERED('table'[Function])
RETURN
SWITCH(
TRUE(),
// [IND_1], [IND_2] and [sale_value] is numeric type data.
A = 1 && B = 3, SUM('table'[sale_value]),
A = 1 && B = 4 && NOT(C), SUM('table'[sale_value]),
A = 2 && B = 5 && NOT(C), SUM('table'[sale_value]),
BLANK()
) * 0.000001
I think the logic of your formula is a bit strange, if this is not what you want, you can describe what kind of effect you want to get.
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous can you share the sample data, how are the values in the table. seems like none of the conditions meets the requirement and switch is going to else section.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
IND_1 | IND_2 | Function | cost_level | sale_value | |||||
1 | 3 | Audit | A | 416994.6 | |||||
1 | 3 | Customer development | B | 178118.43 | |||||
1 | 3 | People Function | C | 0 | |||||
1 | 4 | HR | A | 0 | |||||
2 | 4 | Innovation | B | 0 | |||||
2 | 4 | Audit | C | 0 | |||||
2 | 4 | Innovation | D | 0 | |||||
2 | 5 | NA | NA | 0 | |||||
2 | 5 | NA | NA | 0 | |||||
2 | 5 | NA | NA | 0 |
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
93 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |