Forum Discussion
StefanM
5 years agoHelper II
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...
- 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 vResultDisplay the measure in a card:
DataInsights
5 years agoSuper User
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:
- StefanM5 years agoHelper II
This works brilliantly. The only part I've left to do is to display another year for when the first month is from a different year, but with your easy to follow formula, I don't think that won't be a problem ^^
Thanks a lot DataInsights 👍