cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

zDate Selectedvalue to display a month year in a label (header)

I'm trying to create a measure (label) that will display an header ex: Summary of Results - April 2020
I'm using this dax formula but the date  is not appearing and it is looking like this.. Summary of Results -
To give some contexts, the date is stored in a column Transaction Results Period

Transaction Results Period
January 2020
February 2020
March 2020
April 2020
June 2020
...

Here is the measure I'm using..

Label =
VAR zDate = SELECTEDVALUE('Transaction Results Period'[Results Period])

RETURN
"Summary of Results - " & FORMAT(zDate, "mmm yyyy")

What am I doing wrong? I've tried so many variations such as using _selectedYear instead of zDate and getting the same results ... the date is missing.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: zDate Selectedvalue to display a month year in a label (header)

@jamaicawi , is "Results Period" is a date, if not this will not work as the format of date has been used.

 

Also if its date try

Label =
VAR zDate = max('Transaction Results Period'[Results Period])

RETURN
"Summary of Results - " & FORMAT(zDate, "mmm yyyy")



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Community Support
Community Support

Re: zDate Selectedvalue to display a month year in a label (header)

Hi @jamaicawi ,

I just tried your measure, it works well. Could you please provide the related screen shot about the data and visual/slicer setting in Power BI Desktop? Which data type the field Results Period is?

label.JPG

Best Regards

Rena

View solution in original post

5 REPLIES 5
Highlighted
Super User IV
Super User IV

Re: zDate Selectedvalue to display a month year in a label (header)

@jamaicawi , is "Results Period" is a date, if not this will not work as the format of date has been used.

 

Also if its date try

Label =
VAR zDate = max('Transaction Results Period'[Results Period])

RETURN
"Summary of Results - " & FORMAT(zDate, "mmm yyyy")



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Community Support
Community Support

Re: zDate Selectedvalue to display a month year in a label (header)

Hi @jamaicawi ,

I just tried your measure, it works well. Could you please provide the related screen shot about the data and visual/slicer setting in Power BI Desktop? Which data type the field Results Period is?

label.JPG

Best Regards

Rena

View solution in original post

Highlighted
Helper I
Helper I

Re: zDate Selectedvalue to display a one-month year in a label (header)

@amitchandak,your suggestion worked perfectly.

I still don't understand why what I was using wouldn't work. As shown in the screenshots, the Result Period is in a date format, as shown in the following screenshot.

I will use your suggested solution above as it works. Thank you so much for your help!

Highlighted
Helper I
Helper I

Re: zDate Selectedvalue to display a month year in a label (header)

@yingyinr 

Capture-delete.PNG

Capture-delete1.PNG

capture-delete2.PNG

 

Highlighted
Helper I
Helper I

Re: zDate Selectedvalue to display a month year in a label (header)

@amitchandak- confirming that your solution worked once as I created the Results Period in a DIM. It was previously in a big table which I had imported. That's the only change that I made so that your solution reflects the current month. My query still does not work.

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

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

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors