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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
lgo
Frequent Visitor

Change Title of Series to have it different than column name but depend on it

Hello everyone!

 

I am currently working in a project where I have several columns called:

 

XX - Y0

XX - Y-1

XX - Y-2

XX - Y-3

 

XY - Y0

XY - Y-1

XY - Y-2

XY - Y-3

 

I am currently using those columns to make line charts, however when plotting them in the legend the title of the series are "XX - Y0", "XX - Y-1", etc, as expected, and what I would like to see is that when the series title contains Y0 = then to display current year (in this case "2024"), and when the series title contains Y-1, to display "2023 (2024-1)", etc. So next year, the Y0 series will have 2025 as a title and Y-1 will have 2024.

 

Is this something feasable? I have so far tried to create some measures, but I am not able to see where to place them in order to change my chart.

 

I would appreicate any tips! Thanks a lot,

Laura.

 

1 ACCEPTED SOLUTION

Hi @lgo ,

I created a sample pbix file(see the attachment), please check if that is what you want.

Unpivot and split the columnsUnpivot and split the columns

Column =
VAR _year =
    YEAR ( 'Data-Table (2)'[Date] )
RETURN
    SWITCH (
        'Data-Table (2)'[DYear],
        "Y0", _year,
        "Y1", _year - 1,
        "Y-1", _year - 1,
        "Y2", _year - 2,
        "Y-2", _year - 2
    )

Create calculated column and line chartCreate calculated column and line chart

Best Regards

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

3 REPLIES 3
lgo
Frequent Visitor

https://drive.google.com/file/d/1dXGEQ3DTDon9IogYDLYQTRUgPSRfMXb0/view?usp=sharing , are you able to see it? thanks a lot! (i have also been trying to keep the date as "MMM" format (whithout the year), but i believe that is something that cannot be done)

Hi @lgo ,

I created a sample pbix file(see the attachment), please check if that is what you want.

Unpivot and split the columnsUnpivot and split the columns

Column =
VAR _year =
    YEAR ( 'Data-Table (2)'[Date] )
RETURN
    SWITCH (
        'Data-Table (2)'[DYear],
        "Y0", _year,
        "Y1", _year - 1,
        "Y-1", _year - 1,
        "Y2", _year - 2,
        "Y-2", _year - 2
    )

Create calculated column and line chartCreate calculated column and line chart

Best Regards

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.
_AAndrade
Super User
Super User

Hi,

Can you share a pbix file with one example? I can try to help you.





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




Helpful resources

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