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 IX
Super User IX

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!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

View solution in original post

Highlighted
Microsoft
Microsoft

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 IX
Super User IX

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!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

View solution in original post

Highlighted
Microsoft
Microsoft

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
Meet the 2020 Season 2 Power BI Super Users!

Meet the 2020 Season 2 Power BI Super Users!

Find out who's part of the program this season, and welcome the new Super Users.

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Featured Data Story of The Month

Featured Data Story of The Month

All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.

Power BI Dev Camp - Developing with .NET Core

Power BI Dev Camp - Developing with .NET Core

Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.

Top Solution Authors
Top Kudoed Authors