Forum Discussion

StefanM's avatar
StefanM
Helper II
5 years ago
Solved

Text in a card alongside table data

Hello wizards of PBI! I need some help with a dax measure.  I have a date table include a column of months. For example, [Jan,Feb,Mar,Apr,etc] I also have a slicer on the page based on these month...
  • DataInsights's avatar
    5 years ago

    StefanM, try this measure:

     

    Label Period Selected = 
    VAR vStartDate =
        MIN ( 'Date'[Date] )
    VAR vEndDate =
        MAX ( 'Date'[Date] )
    VAR vYear =
        YEAR ( vEndDate )
    VAR vStartMonth =
        FORMAT ( vStartDate, "mmm" )
    VAR vEndMonth =
        FORMAT ( vEndDate, "mmm" )
    VAR vMonthLabel =
        IF ( vStartMonth = vEndMonth, vEndMonth, vStartMonth & " - " & vEndMonth )
    VAR vResult =
        vYear & " " & vMonthLabel
    RETURN
        vResult

     

    Display the measure in a card: