Forum Discussion
Help for DAX For End Of Quarter
- Anonymous5 years ago
Hi rbhattacharya ,
According to my understanding, you want to get the calculation of the last month of quarter based on the selected month in slicer.
You need to create a new table for slicer like this:
ForSlicer = DISTINCT ( SELECTCOLUMNS ( CALENDAR ( MIN ( 'Original Table'[Date] ), MAX ( 'Original Table'[Date] ) ), "Year", YEAR ( [Date] ), "Month", FORMAT ( [Date], "MMMM" ), "MonthNo", MONTH ( [Date] ), "Quarter", QUARTER ( [Date] ) ) )Then try the following formula:
Measure = VAR _lastMonthofQuarter = MAXX ( FILTER ( ALL ( 'ForSlicer' ), 'ForSlicer'[Quarter] = MAX ( 'ForSlicer'[Quarter] ) && 'ForSlicer'[Year] = MAX ( 'ForSlicer'[Year] ) ), [MonthNo] ) RETURN CALCULATE ( SUM ( 'Original Table'[Value] ), FILTER ( 'Original Table', 'Original Table'[Date].[MonthNo] = _lastMonthofQuarter && 'Original Table'[Date].[Year] = MAX ( 'ForSlicer'[Year] ) ) )The final output is shown below:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey rbhattacharya ,
I didn't fully understand what you want to calculate. Maybe you want to explain that a little further.
Try otherwise the following formula to get the calculation by the end of the quarter:
TechnicalEmployeeHeadcountQt =
CALCULATE(
SUM( 'Budgeting v_IncomeStatement'[AdminCount] ),
DATESQTD( 'Budgeting v_IncomeStatement'[PeriodFormatted].[Date] ),
ENDOFQUARTER( 'Budgeting v_IncomeStatement'[PeriodFormatted].[Date] )
)
- rbhattacharya5 years ago
Helper I
Hello selimovd,
Thanks a lot for the quick response. The suggested DAX didn't solve the problem. I'm getting null (0) value.
I will try and explain the requirement once again. Based on the selected month in the date filter, I want to calculate some value for the end of the quarter month i.e. if the current selected month in the date filter is "January", then I want to calculate some value for "March" i.e. the end of the quarter month. Please note that the calculation should be just for the individual month (March) and not QTD. I want to retrieve value for March on selecting January. Hope this makes the requirement little more clear. 🙂
Regards,
RB