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

Sparkline on switch measure "undefined"

Hey PowerBees

 

I'm working on a BSC-solution and I want to add a sparkline. The solution uses direct query from many separate datamodels, which in turn pull data from our GxP server. The BSC shows >100 KPIs from different areas of the business. They are listed in Time Intelligence columns, to show Last Closed Month, Year to Closed Month, Last 12 Closed Months and a sparkline for the Last 12 Closed Months.

The KPIs are calculated by separate measures and combined with a single switch measure, like so:
_ExampleSelector =

VAR vSelectedMeasure = SELECTEDVALUE('KPIlist'[KPI],"NONE")

VAR vMeasureToDisplay = SWITCH( vSelectedMeasure

,"ExampleKPI1", [ExampleMeasure1]

//,"ExampleKPI2", [ExampleMeasure2]

//,"ExampleKPI3", [ExampleMeasure3]

,BLANK())

RETURN vMeasureToDisplay

 

Using the above I get no sparkline graph and the hover says "undefined".

If I use the individual measures the sparkline works fine, so I believe the problem is isolated to the measure linked above.
Do you have any tips I can try to fix this?

 
2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Can define a default measure when nothing is selected

 

_ExampleSelector =

VAR vSelectedMeasure = SELECTEDVALUE('KPIlist'[KPI],"ExampleKPI1")

VAR vMeasureToDisplay = SWITCH( vSelectedMeasure

,"ExampleKPI1", [ExampleMeasure1]

//,"ExampleKPI2", [ExampleMeasure2]

//,"ExampleKPI3", [ExampleMeasure3]

,[ExampleMeasure1])

RETURN vMeasureToDisplay

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

Thanks, This worked for me in a similar scenario!!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.