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
admin11
Memorable Member
Memorable Member

Can y straight column label display year dynamic ?

Hi All

 

My below expression the label will display Sales YTD , may i know how to make it dynamic display the year i selected , For example if i select year = 2018 , how to make it display 2018 , instead of alway display Sales YTD :-

 
Sales YTD =
var _max = date(year(today())-0,month(today()),day(today()))
return
TOTALYTD(('SALES'[SALES_]),dateadd('Date'[Date],-0,year),'Date'[Date]<=_max)

admin11_0-1618140322481.png

 

1 ACCEPTED SOLUTION
sayaliredij
Super User
Super User

You can add something like below

 

sayaliredij_0-1618215064380.png

Does it help?

 

Regards,

Sayali

 





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

Proud to be a Super User!




View solution in original post

6 REPLIES 6
dhooger
Helper I
Helper I

I'm not finding a solution on this thread. I want to do something similar. Have a calculation group for the last four years and instead of the Name of the Calculation Items, I want to display the Max(Date[Year]). 

dhooger_0-1650480002289.png

Thus the legend would update if someone changes the slicer. I have created a calculated column in the PBIX file but can't seem to figure out how to use that column in some Expression for the Name.

 

sayaliredij
Super User
Super User

You can add something like below

 

sayaliredij_0-1618215064380.png

Does it help?

 

Regards,

Sayali

 





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

Proud to be a Super User!




sayaliredij
Super User
Super User

You can use a matrix instead of a table. 

 

In Rows you can mention "Customer Name"

 

In Columns "Year"

 

In Values = Sales amount

 

You will get the result you wanted

 

Regards,

Sayali 

If this post helps, then please consider Accept it as the solution to help others find it more quickly.

 

 





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

Proud to be a Super User!




@sayaliredij 

 

Thank you for your sharing .

I just try it work fine .

admin11_0-1618191391410.png

But what i need is how to compute YTD vs LYTD. Now i am using stright table , it have no issue.

admin11_1-1618191658776.png

 

Paul Yeo

 

Paul Yeo

Sorry I did not understand. 

 

I see you are getting the measure you require. Is there something missing? Could you please explain more?

 

Regards,

Sayali





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

Proud to be a Super User!




@sayaliredij 

Sorry my explanation not so clear. 

notice that i only can achieve YTD vs LYTD sales by stright table. For Martix table i am not able to have YTD vs LYTD sales.

admin11_0-1618209235809.png

Below is my PBI file :-

https://www.dropbox.com/s/lx95lxy4q853wga/PBT_V2021_398_%20TI_SI_SAMPLE%20-%20Copy.pbix?dl=0

 

Paul

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.