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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
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
v-lionel-msft
Community Support
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

ab1.PNG

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.

 

View solution in original post

3 REPLIES 3
v-lionel-msft
Community Support
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

ab1.PNG

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.

 

parry2k
Super User
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_1IND_2Functioncost_levelsale_value     
13AuditA416994.6     
13Customer developmentB178118.43     
13People FunctionC0     
14HRA0     
24InnovationB0     
24AuditC0     
24InnovationD0     
25NANA0     
25NANA0     
25NANA0     

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors