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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Slicer Visualization

Hi All,

 

Is there any work around to use the values passed by the slicer visualization as a parameter in the Measure calculation..?

Like Slicer Year has 2 values 2014 and 2015

When I select 2015 I want to pass the 2015 as a parameter to a function like 

PreviousYear() to get its previous year value dynamically. 

 

Thanks in advance

1 ACCEPTED SOLUTION
ankitpatira
Community Champion
Community Champion

@Anonymous you can create a measure and use HASONEVALUE and FIRSTNONBLANK in conjunction to achieve this. Check out this example I've provided.

View solution in original post

2 REPLIES 2
ankitpatira
Community Champion
Community Champion

@Anonymous you can create a measure and use HASONEVALUE and FIRSTNONBLANK in conjunction to achieve this. Check out this example I've provided.

Anonymous
Not applicable

Hi @ankitpatira,

 

That works fine i tried following expression in a measure 

Title = IF(HASONEVALUE(Table[Year]),FIRSTNONBLANK(Table[Year],TRUE),0)

I am getting 2015 or 2014 depending upon my selection

but i want to use it like this

1. CALCULATE(Fact[Revenue],FILTER(Table,Table[Year] = [Title])) as 'Current Year Revenue'

2. CALCULATE(Fact[Revenue],FILTER(Table,Table[Year] = [Title]-1)) as 'Previous Year Revenue'

when i select 2015 in the slicer

1 is coming but there is no data for 2.

did i miss anything?

the chart will display both the measures in value section

Categories: Months

Values: Current Year Revenue

             Previous Year Revenue

 

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.