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
rbhattacharya
Helper I
Helper I

Help for DAX For End Of Quarter

Hello,

 

Please refer to the attached screenshot which is a date filter in my report. Based on the current selected month (January), I need to derive some calculated value for the end of quarter month i.e. March in this case. I'm using ENDOFQUARTER Dax, but it is producing blank. This is the DAX I'm using:

 

TechnicalEmployeeHeadcountQt = CALCULATE(SUM('Budgeting v_IncomeStatement'[AdminCount]), DATESQTD(ENDOFQUARTER('Budgeting v_IncomeStatement'[PeriodFormatted].[Date])))
 
Maybe I'm not using the end of quarter DAX properly. Kindly help.
 
 
Capture.JPG
Regards,
RB
1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

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:

last month of quarter.PNG

 

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.

View solution in original post

3 REPLIES 3
v-eqin-msft
Community Support
Community Support

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:

last month of quarter.PNG

 

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.

selimovd
Super User
Super User

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] )
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

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

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.