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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
nebulus
Frequent Visitor

Text column to create DAX formula or refer to KPI measure

My scenario:

  • line visual shows KPI value per month
  • filter selection to choose KPI to be shown in above visual
  • one table contains all the KPIs that can be selected from above filter
  • I have over 40 KPIs to choose

 

Do I add one additional column for DAX formulas to be used when KPI is selected or create each KPI as indivudual DAX formula?

How do I refer these in DAX formula?

 

Example:

I choose to show "Sales" on my line visual. I think that the simplest way is to use sum(Sales) KPI and refer to this in IF() or SWITCH() clause.

 

value = if ( selectedvalue ( KPI ) = "Sales" , [Sales] , null)

 

But how this changes if I have another column that says which KPI to use or it says what DAX to use?

2 REPLIES 2
amitchandak
Super User
Super User

@nebulus ,  Are you looking to change measure based in slicer value ?

 

example 

value = Switch( selectedvalue ( KPI ) ,

"Sales" , [Sales]

"COGS" , [COGS]

 

, blank())

 

 

use blank() in place of null, in you, if, if that is the only change you need

 

refer if needed

measure slicer
https://www.youtube.com/watch?v=b9352Vxuj-M
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for your answer @amitchandak 

 

This solution is the same as I described on my post. My problem is that I have over 40 measures and there will be more in the future.

 

I have following table that I would like to use:

 

KPIDAX expressionMeasure name
Salessum(Sales)[Sales]
COGSsum(COGS)[COGS]

 

value = min ( DAX expression )

or

value = min ( Measure name )

 

Is there a way to convert text to DAX expression of to refer to created measure?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.