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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
StefanM
Helper II
Helper 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 months. The slicer is hidden away inside a Slicer Panel. 

I want to have a card at the bottom of the page outputting the date range selected. 

 

Something like: "first month" - "last month", which would output Feb-Apr etc

I would also like it to only output 1 month if only 1 is selected. 

 

I've never really messed around with adding text in this way. Is it possible?

1 ACCEPTED SOLUTION
DataInsights
Super User
Super 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:

 

DataInsights_0-1600440730096.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
DataInsights
Super User
Super 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:

 

DataInsights_0-1600440730096.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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  👍

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.