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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
meena16_vibrant
Frequent Visitor

DAX Help

In a matrix, I need to show below measures for each column.

meena16_vibrant_0-1676446997751.png

 

coln 1measure 2
coln 2Average(coln4)
coln 3Max(Coln4)

I tried using below measure but I get error. Please help to get the write DAX.

Measure 1 =
SWITCH (
SELECTEDVALUE( Table[coln 1] ), Measure 2,
SELECTEDVALUE( Table[coln 2] ), AVERAGE ( coln4 ),
SELECTEDVALUE ( Table[coln 3] ), MAX ( coln4 )
)

3 REPLIES 3
AllisonKennedy
Community Champion
Community Champion

@meena16_vibrant 

 

What does your 'Table' look like?

 

You need to use true/false (yes/no) questions in your SWITCH, for example:

 

Measure 1 =
SWITCH (
SELECTEDVALUE( Table[coln] ) = "coln 1", [Measure 2],
SELECTEDVALUE( Table[coln] ) = "coln 2", AVERAGE ( coln4 ),
SELECTEDVALUE ( Table[coln] ) = "coln 4", MAX ( coln4 )
)

 

Can you provide more detail on what you're trying to acheive?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

@AllisonKennedy 

 

meena16_vibrant_1-1676452569455.png

 

This how table looks. I have given dummy data 

@meena16_vibrant  Thanks - can you make your dummy data a bit more meaningful? I can't see why you have two rows with almost the same data and why that same data needs to be the trigger for a different measure. Can you simply do three measures:

 

AAA = [measure1]

BBBB = AVERAGE(table[coln4])

CCC = MAX(table[coln4])

 

And add those three measures to a matrix or table visual?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.