cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abap32
Frequent Visitor

Display Slicer value dynamically on card

I have a Month slicer and i want to display the Month name of the selected number ( 8 = August) on a card.

 

 Untitled.png

 

I am using the following measure: 
dynamic_text_last = "Sum of January until " & LASTNONBLANK(Month_Table[Column_Month_Names],Month_Table[Column_Month_Names])

What i get as a result is the following:
 card.png

Somehow the sorting of the table is lost while using the LASTNONBLANK function. I figured that out while entering the number 12 for December and got September on the card instead. If you sort the months by their name, then September is the 12th month. That seems to be the case here - my original sorting by monthID is replaced magically with an alphabetical order. I have been trying for hours and i cannt find a workaround this problem.

I hope that someone could provide a solution to that matter!

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft
Microsoft

Hi @abap32,

 

Based on my test, the formula below should work in your scenario. Smiley Happy

dynamic_text_last =
"Sum of January until "
    & FORMAT ( DATE ( 1900, MAX ( Month_Table[Column_Month_Number] ), 1 ), "mmmm" )

m1.PNG

 

Regards

View solution in original post

11 REPLIES 11
v-ljerr-msft
Microsoft
Microsoft

Hi @abap32,

 

Based on my test, the formula below should work in your scenario. Smiley Happy

dynamic_text_last =
"Sum of January until "
    & FORMAT ( DATE ( 1900, MAX ( Month_Table[Column_Month_Number] ), 1 ), "mmmm" )

m1.PNG

 

Regards

View solution in original post

@v-ljerr-msft Is there a possibility to alter your code in order to display the Month names in German language?

Hi @abap32,

 

Try the formula below. It may not be a smart way, but it should work. Smiley Happy

dynamic_text_last = 
VAR monthNameInGerman =
    SWITCH (
        MAX ( Month_Table[Column_Month_Number] ),
        1, "der Januar",
        2, "der Februar",
        3, "der März",
        4, "der April",
        5, "der Mai",
        6, "der Juni",
        7, "der Juli",
        8, "der August",
        9, "der September",
        10, "der Oktober",
        11, "der November",
        12, "der Dezember"
    )
RETURN
    "Sum of January until " & monthNameInGerman

Regards

@v-ljerr-msft i cannot thank you enough!

Many many many thanks @v-ljerr-msft

vcastello
Resolver III
Resolver III

Hi @abap32 

When you say ...

"That seems to be the case here - my original sorting by monthID is replaced magically with an alphabetical order"

means that you selected the 'Order by Column' feature and it does not work? Or that you originally sorted by monthID in the original table?

Vicente

abap32
Frequent Visitor

Hi @vcastello,

i have used both ordering options on monthID. However the values that are returned from that LASTNONBLANK function are ordered by name. I cannot find another explanation why i am getting the wrong month name returned ( which only makes sense if the month name is ordered alphabetically).

Hi @abap32

Try changing the formula to ...

dynamic_text_last = "Sum of January until " & MAX(Month_Table[Column_Month_Names])

abap32
Frequent Visitor

Hi @vcastello,

didnt work. 

Hi @abap32

Could you provida a sample .pbix file somewhere to see exactly the data model?

 

Thanks

 

Vicente

abap32
Frequent Visitor

Thank you for your help @vcastello, but i am really not allowed to do this. I will keep fighting the beast alone 🙂

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Get Ready for Power BI Dev Camp

Power BI Dev Camp - June 24th

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors