Forum Discussion
Quarter as Date in parameters
Hi Anonymous,
It´s difficult to provide you with detailed steps without more information. However, to solve this issue, you can create a calculated column in your date table that will extract the quarter from the date. You can then use this calculated column as a filter in your visualizations.
Here are the steps to create a calculated column:
Go to the date table in Power BI and select "New Column" from the "Modeling" tab.
In the formula bar, enter the following formula to extract the quarter from the date:
Quarter = "Q" & CEILING(MONTH([Date])/3) & " " & YEAR([Date])
This formula will create a new column with the quarter and year information in the format of "Q1 2022", "Q2 2022", etc.
Click "Enter" to create the calculated column.
Now, you can use this new column as a filter in your visualizations. In the "Visualizations" pane, select your bar chart and drag the "Quarter" column to the "Filters" section.
Select the quarters you want to display in your bar chart and click "OK".
With this new calculated column, your bar chart should display the bars in chronological order based on the quarters.
Best regards,
Isaac Chavarria
If this post helps, then please consider Accepting it as the solution and giving Kudos to help the other members find it more quickly.
- Bali20223 years agoFrequent Visitor
Just one thing to add to your formula. There needs to be a 1 before the close of the CEILING function to designate the "significance" and round the calculated value to the nearest integer:
Quarter = "Q" & CEILING(MONTH([Date])/3, 1) & " " & YEAR([Date]) - Duinhir2 years agoNew Member
Hello Isaac, I found your help very useful. My problem is that I have multiple years and when I try to sort them PowerBi sort them alphabetically, because it's set as Text. If I try to modify the "Data Type" in date, then I get an error. How to sort Q12023 - Q2 2023 - ... instead of Q1 2023 - Q1 2024 - Q2 2023 - ... ?