Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I'm wondering for chart filter, is it possible to use a variable? Right now, I have to hard-code a number.
Appreciated!
Solved! Go to Solution.
ok, now i understand. I was able to do this in excel 2013 with the old power query and powerpivot where by you fiddled with a piece of M code and could write back a variable from the spreadsheet into the datamodel. I will try and track it down but have had no luck so far. I bet you can still do it in powerbi given that its all the same - it will involve passing back value from an unrelated table. Sorry i dont have a solution at hand.
Have you found a solution? I'm struggling with the same problem. I managed to use a parameter to filter measures displayed in cards but not charts
@captainlaw On top of what @samdthompson requested, i am guessing you're referring to paramter that can be passed to filter in a report. If yes then in power bi service you can't access parameters that you create in power bi desktop yet but there is a way to programatically pass filter values to a report in power bi.
Report URL looks like
https://app.powerbi.com/groups/me/reports/7fe9a5d0-adff-4e98-bad0-dd77d64ce836/ReportSection
You can specify filter values to report url as described in this post.
Hello Ankit,
I'm actually trying to accomplish parameter/variable in desktop not the service. Is that possible? If so, is there a blog describing how to accomplish that?
Appreciated!
Assuming that you are wanting a static > 5 for example, can you do something like this.... =calculate([measure],filter(table,table[measure]>5)). Is that what you are looking for?
Dynamic filtering is what I'm looking for.
I don't think the dropdown filter selection box allows me to enter code. Let me know if my assumption is incorrect.
I also tried Parameter, but with no avail.
Its a measure to write. Go to modelling on the menu and then to new measure. If LAWRank is not a defined measure already it might need to be something like:
=calculate(sum[table[LAWrank],filter(table,table[measure]>5))
The goal is to make it dynamic so without hardcoding but allow user selection.
ok, now i understand. I was able to do this in excel 2013 with the old power query and powerpivot where by you fiddled with a piece of M code and could write back a variable from the spreadsheet into the datamodel. I will try and track it down but have had no luck so far. I bet you can still do it in powerbi given that its all the same - it will involve passing back value from an unrelated table. Sorry i dont have a solution at hand.
How is this dynamic?
Hi can you please explain a little more on what you mean by filtering with a variable and where you hard code anything.
Yes. I've attached a screenshot of the chart filter. I hard-coded the field to only <= 5 Would love to apply variable to replace 5.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
72 | |
38 | |
31 | |
26 |