The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
I just shared the interview question that asked to me during on the interview.
Consider we have only 2 dates.
Date:--------Previous Month
09/01/2022- Dec
09/02/2022- Jan
We have to create a measure or column to show the Previous month of the each date:
I tried PreviousMonth(Table[Date], its returning only jan in February Month. But in January its not returning the Dec Month.
I dont know its is possible or not. Please advice.
result that i got.
Solved! Go to Solution.
what about:
Measure or Column = EDATE ( 'Table'[Date], -1 )
or
= MONTH( EDATE ( 'Table'[Date], -1 ))
Found another one 🙂
Measure Previous Month =
MONTH(EOMONTH(MAX(Dates[Date]),-1))
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
lease try the following
base data
Mesure and result
formula:
Measure Previous Month =
var var_ReferenceDate = MONTH(MAX(Dates[Date]))
Return
IF(var_ReferenceDate=1,12,var_ReferenceDate-1)
There might be a better solution but this is the quick and dirty one 🙂
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
what about:
Measure or Column = EDATE ( 'Table'[Date], -1 )
or
= MONTH( EDATE ( 'Table'[Date], -1 ))
you are welcome. Good luck with the interview.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
79 | |
71 | |
48 | |
39 |
User | Count |
---|---|
136 | |
108 | |
70 | |
64 | |
57 |