cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Anonymous
Not applicable

## Help Need In DAX

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.

1 ACCEPTED SOLUTION
Community Support

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.

3 REPLIES 3
Community Support

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.

Super User

@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.

Anonymous
Not applicable
 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

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.