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.
Hello,
I am getting an error when using a Dax to pull the previous month name into smart narrative.
DAX
Last Month = CALCULATETABLE(VALUES('Date'[MonthInCalendar]),DATEADD('Date'[Date],-1,MONTH))
I am getting an error:
Solved! Go to Solution.
I needed a previous month as text in the format of Month Year like April 2021...
I had a formula that was working using value in visuals but not in text box as a value.
After trying a few formulas and researching and came up with this and it dynamic value no longer gives me an error that multiple results were given when a single value was expected:
Hi @zzakir ,
Use the below measure:
Last Month =
VAR test1 =
CALCULATE (
VALUES ( 'Date1'[MonthInCalendar] ),
FILTER (
ALL ( date1 ),
MAX ( date1[Date] ) = DATEADD ( date1[Date], 1, MONTH )
)
)
RETURN
IF ( test1 = BLANK (), 12, test1 )
Wish it is helpful for you!
Best Regards
Lucien
I needed a previous month as text in the format of Month Year like April 2021...
I had a formula that was working using value in visuals but not in text box as a value.
After trying a few formulas and researching and came up with this and it dynamic value no longer gives me an error that multiple results were given when a single value was expected:
@zzakir ,
This is going to create a table, are you trying this in a measure or table.
@amitchandak @I am trying this Dax in a measure so that I can use it in text box as a dynamic "value".
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 |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |