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

Join 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.

Reply
Settz
New Member

Bar Chart Filter and X Axis Column Selection

Hi

 

I have a report that is using a Bar Chart Visualiser to present quantities on Y Axis and Date on the X Axis.

 

The I need to be able to change the date used on the X Axis between Order Entry Date and Delivery Date - pretty easy so far with a Parameter.

What I am struggling with is that the sales orders to be included in the bar chart fall within a 'Reporting Date Range' that is based on todays date -1 day and todays date + 5 days.

 

So when the user selects a date option from the Parameter Slicer  need to filter Bar Chart based on the date field selected and the date range for the the selected field.

I have created 2 flag columns in the data source that calculates and presents whether a sales order Order Entry date falls within the Reporting Window and another that indicates if the delivery date falls within the reporting window.

 

Settz_0-1748081471697.png

 

Many Thanks

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @Settz  -Create a Parameter Table

eg: DateParam =
DATATABLE(
"Date Type", STRING,
{
{"Order Date"},
{"Delivery Date"}
}
)

 

Now, create a measure that dynamically filters the data based on the selected date type and only includes rows in the reporting window.

 

ShowQty :=
VAR SelectedDateType = SELECTEDVALUE(DateParam[Date Type])
RETURN
CALCULATE(
SUM(Orders[Qty]),
FILTER(
Orders,
(SelectedDateType = "Order Date" && Orders[In Entry Window] = 1) ||
(SelectedDateType = "Delivery Date" && Orders[In Deliv Window] = 1)
)
)

 

Create a calculated column or use a measure to switch the date used on the X-axis

SelectedDate :=
SWITCH(
SELECTEDVALUE(DateParam[Date Type]),
"Order Date", Orders[Order Date],
"Delivery Date", Orders[Delivery Date]
)

you will need to create a disconnected calculated table or duplicate your date field and then filter it accordingly in your visual. Hope this works. please check 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

4 REPLIES 4
v-sshirivolu
Community Support
Community Support

Hi  @Settz ,
Just wanted to check if you had the opportunity to review the suggestion provided?

If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it.

 

Thank you.

 

Hi @Settz ,

Just wanted to check if you had the opportunity to review the suggestion provided?

If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it.

 

Thank you.

Hi @Settz 
Just wanted to check if you had the opportunity to review the suggestion provided?

If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it.

 

Thank you.

rajendraongole1
Super User
Super User

Hi @Settz  -Create a Parameter Table

eg: DateParam =
DATATABLE(
"Date Type", STRING,
{
{"Order Date"},
{"Delivery Date"}
}
)

 

Now, create a measure that dynamically filters the data based on the selected date type and only includes rows in the reporting window.

 

ShowQty :=
VAR SelectedDateType = SELECTEDVALUE(DateParam[Date Type])
RETURN
CALCULATE(
SUM(Orders[Qty]),
FILTER(
Orders,
(SelectedDateType = "Order Date" && Orders[In Entry Window] = 1) ||
(SelectedDateType = "Delivery Date" && Orders[In Deliv Window] = 1)
)
)

 

Create a calculated column or use a measure to switch the date used on the X-axis

SelectedDate :=
SWITCH(
SELECTEDVALUE(DateParam[Date Type]),
"Order Date", Orders[Order Date],
"Delivery Date", Orders[Delivery Date]
)

you will need to create a disconnected calculated table or duplicate your date field and then filter it accordingly in your visual. Hope this works. please check 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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