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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
luc
Frequent Visitor

Is there a way to use parameters as start and end of axis range?

By start and end of axis range, I mean these fields in the following image:
power-bi-y-axis.png

 

If you're curious why, I have a report model that asks for a startdate and enddate parameters when opened. I these dates to be the range for the visuals on this report.

3 REPLIES 3
Anonymous
Not applicable

Hey @luc

 

Short answer: I would just add a date slicer to your report and set the start and end date. You can sync this slicer across all pages of your report as well.

 

Long answer: Create your parameters and enable load in the Query Editor. Then you can create a calculated column that will look something like:

 

InRange = 
IF(
    AND(FIRSTNONBLANK(StartDate[StartDate],1) <= Table1[Date], FIRSTNONBLANK(EndDate[EndDate],1) >= Table1[Date])
    "Yes",
    "No"
)

Then you can add a Report Level filter for InRange = "Yes".

 

Hope this helps,

Parker

 

luc
Frequent Visitor

That doesn't work, I already filter the data based on these parameters when querying the data source. The problem is that if I want for example the x axis from a a visual to go from 03/01 to 03/31, if the y axis of that visual has value 0 at 03/01 the visual will automatically resize the x range to go from 03/02 to 03/31. Instead of resizing I want the visual to show a 0 even if there is no data for the first day of March.

Anonymous
Not applicable

I would receommend a Date table with a list of continuous dates in your date range. You can then set your X axis to use this date range and still use the calculated column I provided above. As for showing a 0 for that first date, I'm not sure about that. It might just show up as a blank.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.