Forum Discussion
Smart Narrative Error: Couldn't Load Data for this Visual
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:
- Anonymous5 years ago
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:
Last Month Alt =VAR test1 = LOOKUPVALUE('Date'[MonthInCalendar],'Date'[Date],DATEADD(ENDOFMONTH('Date'[Date]),-1,MONTH))Returntest1Closing this post.
4 Replies
- amitchandakSuper User
Anonymous ,
This is going to create a table, are you trying this in a measure or table.
- AnonymousNot applicable
amitchandak @I am trying this Dax in a measure so that I can use it in text box as a dynamic "value".
- v-luwang-msftCommunity Support
Hi Anonymous ,
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
- AnonymousNot applicable
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:
Last Month Alt =VAR test1 = LOOKUPVALUE('Date'[MonthInCalendar],'Date'[Date],DATEADD(ENDOFMONTH('Date'[Date]),-1,MONTH))Returntest1Closing this post.