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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mmcanelly
Helper I
Helper I

Sparkline for Dynamic Measure

I have a table of dynamic measures where I want to add a sparkline for each. The table looks something like this:

 

Metric NameValue
Metric 1$150,000
Metric 24.5%
Metric 36.0%

 

The "Value" column is a measure set up as follows:

 

Metric Value = 
VAR SelectedMetric = SELECTEDVALUE ('Dynamic Metrics'[Metric Name])
RETURN
SWITCH (
    SelectedMetric,
    "Metric 1", [Metric 1 MTD Value],
    "Metric 2", [Metric 2 MTD Value],
    "Metric 3", [Metric 3 MTD Value]
)

 

 

I want to add a sparkline for each of the rows in the table showing weekly values. I've been able to set up individual measures for each sparkline that work when I test them on their own, but as soon as I add them to a dynamic measure setup similar to the formula above where I'm selecting the measure based on SELECTEDVALUE('Dynamic Metrics'[Metric Name]), they no longer work and the sparklines show up as blank.

 

Is there a way to handle this where I can show the sparkline for a separate measure in each row?

1 ACCEPTED SOLUTION

Hi @mmcanelly 

Please update the formula to :

Metric Total2 =
VAR SelectedMetric = SELECTEDVALUE (Metrics[Metric Name])
RETURN
if (ISBLANK(SelectedMetric),"",
SWITCH(SelectedMetric,
"Def $",[Total Def $],
"CCIR",[CCIR],
"QER",[QER]))
Result :
Ritaf1983_0-1703648140497.png

Modified pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other

members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

4 REPLIES 4
mmcanelly
Helper I
Helper I

Hi @Ritaf1983 ,

Here's a link to the dummy pbix file: https://drive.google.com/file/d/1_JmmZAI7K61bTAIdDOvpyS29oMu7tVDR/view?usp=drive_link. On the visual, the table on the right is the one I'm trying to get working but the sparkline is showing up as blank. The intent is to have the sparkline for each corresponding metric be the only one shown in that row (so only the ones highlighted in the attached screenshot).

mmcanelly_0-1703621638461.png

 

Ritaf1983
Super User
Super User

Hi @mmcanelly 
Can you please share a link to dummy pbix?

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi @mmcanelly 

Please update the formula to :

Metric Total2 =
VAR SelectedMetric = SELECTEDVALUE (Metrics[Metric Name])
RETURN
if (ISBLANK(SelectedMetric),"",
SWITCH(SelectedMetric,
"Def $",[Total Def $],
"CCIR",[CCIR],
"QER",[QER]))
Result :
Ritaf1983_0-1703648140497.png

Modified pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other

members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Thank you @Ritaf1983!! This fixed the issue. Any idea why adding the if-isblank logic fixes this? I would think the original formula should give the same result, but obviously it's not.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.