March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Try to figure out the data of First Month End in Each Quarter
eg, how to figure out the value of 1/28/2021
Solved! Go to Solution.
Hi,
Please kindly check the below picture and the attached pbix file whether it suits your requirement.
Target Date To: =
VAR _quarterlast =
ENDOFQUARTER ( Data[SnapShotDate] )
VAR _newtable =
MINX (
ADDCOLUMNS (
FILTER ( ALL ( Data ), ENDOFQUARTER ( Data[SnapShotDate] ) > _quarterlast ),
"@monthlast", CALCULATE ( ENDOFMONTH ( Data[SnapShotDate] ) )
),
[@monthlast]
)
RETURN
IF ( HASONEVALUE ( Data[SnapShotDate] ), _newtable )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi, @Cocohcy
You can try the following methods.
Month = MONTH([Date])
Quarter = QUARTER([Date])
Measure =
VAR _firstmonth = CALCULATE ( MIN ( 'Table'[Month] ),
FILTER ( ALL ( 'Table' ), [Quarter] = SELECTEDVALUE ( 'Table'[Quarter] ) )
)
RETURN
CALCULATE ( MAX ( 'Table'[Date] ),
FILTER ( ALL ( 'Table' ),
[Month] = _firstmonth
&& [Quarter] = SELECTEDVALUE ( 'Table'[Quarter] )
)
)
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply. The method looks great and simple to understand. But my data range is rolling between 2021 to 2023 so it comes out 2023 data when calcuate 2021. Please see my result in Picture 1.
Additionally, to be more specific on what I am asking. Actually I am trying to find next qtr's firstmonth last snapshot to compare with all the data in this qtr. See picture 2.
Hi,
I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
I hope the below can provide some ideas on how to create a solution for your data model.
Expected result measure: =
VAR _quarterlast =
ENDOFQUARTER ( Data[SnapShotDate] )
VAR _monthlast =
ENDOFMONTH ( Data[SnapShotDate] )
VAR _newtable =
MINX (
ADDCOLUMNS (
FILTER ( ALL ( Data ), ENDOFQUARTER ( Data[SnapShotDate] ) = _quarterlast ),
"@monthlast", CALCULATE ( ENDOFMONTH ( Data[SnapShotDate] ) )
),
[@monthlast]
)
RETURN
IF ( HASONEVALUE ( Data[SnapShotDate] ), _newtable )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi Jihwan, the way works in my PBI calculation. But it;s complicate for me to modify, may I know if I want to catch next qtr's first month last snapshot to compare with this qtr's data. How to acheive in DAX?
Hi,
Please kindly check the below picture and the attached pbix file whether it suits your requirement.
Target Date To: =
VAR _quarterlast =
ENDOFQUARTER ( Data[SnapShotDate] )
VAR _newtable =
MINX (
ADDCOLUMNS (
FILTER ( ALL ( Data ), ENDOFQUARTER ( Data[SnapShotDate] ) > _quarterlast ),
"@monthlast", CALCULATE ( ENDOFMONTH ( Data[SnapShotDate] ) )
),
[@monthlast]
)
RETURN
IF ( HASONEVALUE ( Data[SnapShotDate] ), _newtable )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
133 | |
90 | |
88 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
70 | |
68 |