Forum Discussion
Dax Formula for Finding Quarter
Hello everyone,
I need a DAX formula as measure or calculated column to generate a report with data for the current quarter, previous quarter, and the last two years of all quarters in a single column for single selection date value in a slicer. Help me to find a solution.
Example :
If Selected date is 10-Feb-2025, I need value like
Category Values
Quaters Q1-23
Q2-23
Q3-23
Q4-23
Q1-24
Q2-24
Q3-24
Previous Quaters Oct-24
Nov-24
Dec-24
Q4-24
Current Quarters Jan-25
Current Months Week1 - 3 Feb(First Monday of week )
2 Replies
- rajendraongole1
Super User
Hi Donglee26 - I hope you already have a date table, if not create a calculated table that dynamically generates the required quarter and month breakdown based on a selected date from a slicer.
DateTable =
ADDCOLUMNS (
CALENDAR (DATE(2020, 1, 1), DATE(2030, 12, 31)),
"Year", YEAR([Date]),
"Month", FORMAT([Date], "MMM-YY"),
"Quarter", "Q" & FORMAT([Date], "Q-YY"),
"Week", "Week" & FORMAT([Date] - WEEKDAY([Date],2) + 1, " DD MMM") // Week starts from Monday
)for dynamic , i have attached pbix with calcluation. please check.
Now add Category to Rows.
Add Values to Values.Hope this helps.
- Donglee26New Member
Hi Rajendraongole, thank for the reply
Even if I add Category to Rows and add Values to Values I am not getting my required output,
You have tried to add as a measure which you have sent above but it will not work I have already tried of creating measure and calculated column, it will through an error "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."