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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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

@Anonymous , 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")

View solution in original post

v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

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

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

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

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

amitchandak
Super User
Super User

@Anonymous , 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")

Anonymous
Not applicable

@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.

Anonymous
Not applicable

@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!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.