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 dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi All,
I have a report with a bar chart to show the Sales values for 3 consequent years.
Now we are in the year 2023. I should show 2023,2022 and 2021 values in the bar chart.
At this moment, I am passing the year parameter 2021 value manually. How to pass this value dynamically?
I have seen query options (in the attached image) from this link but don't know how to enable them.
https://learn.microsoft.com/en-us/power-query/power-query-query-parameters
Please help me.
Solved! Go to Solution.
Hi @Anonymous
Do you have a Year column in your table and you are using the Year column to filter rows in years 2023,2022 and 2021? If so, you can first filter rows by Year column to select rows greater than or equal to 2021. You will get an M code generated in the formula bar. Then replace 2021 with Date.Year(DateTime.LocalNow()) - 2. This will return the year value based on your system datetime dynamically.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @Anonymous
Do you have a Year column in your table and you are using the Year column to filter rows in years 2023,2022 and 2021? If so, you can first filter rows by Year column to select rows greater than or equal to 2021. You will get an M code generated in the formula bar. Then replace 2021 with Date.Year(DateTime.LocalNow()) - 2. This will return the year value based on your system datetime dynamically.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
User | Count |
---|---|
8 | |
6 | |
6 | |
5 | |
5 |
User | Count |
---|---|
9 | |
8 | |
6 | |
6 | |
6 |