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.
I am trying to display the previous month's text into a measure which will be displayed into a KPI. The odd part is that when I use "Month( Today() ) -1" it will give me an output of "Jan 1900". The goal is to have an output of "May 2021". Any advice on how I am able to write a measure that will give me an output of the previous Month and Year? Below is my current DAX + current/expected output.
Previous Month's KPI Card =
VAR Previous_Month = [Previous Month's Count]
RETURN
SWITCH( TRUE(),
Previous_Month >= 0, "Previous Month's Alerts: " & FORMAT( MONTH( TODAY() ) -1, "MMM YYYY" )
)
Current Output = "Previous Month's Alerts: Jan 1900"
Expected Output = "Previous Month's Alerts: May 2021"
Any advice is greatly appreciated.
Solved! Go to Solution.
@Anonymous thank you so much for the support. I actually found a solution that worked best for me: EDATE( Today(), -1)
FORMAT( EDATE( TODAY(), -1 ), "MMM YYYY" )
If you have a date table use the date column instead of "-1". When you use MONTH function it calculates dates as numbers and then it formats it.
You could use PARALLELPERIOD, DATEADD or PREVIOUSMONTH as alternatives as well if you have a date column.
@Anonymous thank you so much for the support. I actually found a solution that worked best for me: EDATE( Today(), -1)
FORMAT( EDATE( TODAY(), -1 ), "MMM YYYY" )
Cool! Didn't know that function existed! Thanks for sharing!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
81 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |