Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
zzakir
Helper II
Helper II

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:

zzakir_0-1624363277784.png

 

 
Dax works fine on a card:

zzakir_1-1624363484568.png

 

 

 

1 ACCEPTED 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:

 

Last Month Alt =
VAR test1 = LOOKUPVALUE('Date'[MonthInCalendar],'Date'[Date],DATEADD(ENDOFMONTH('Date'[Date]),-1,MONTH))
Return
test1
 
Closing this post.

View solution in original post

4 REPLIES 4
v-luwang-msft
Community Support
Community Support

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 )

 

vluwangmsft_0-1624607012348.png

 

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:

 

Last Month Alt =
VAR test1 = LOOKUPVALUE('Date'[MonthInCalendar],'Date'[Date],DATEADD(ENDOFMONTH('Date'[Date]),-1,MONTH))
Return
test1
 
Closing this post.
amitchandak
Super User
Super User

@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".

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.