Forum Discussion

Babu34's avatar
Babu34
New Member
1 year ago
Solved

undefined

Hi I want to display number of requests on monthly basis by year and by service type( I have two service types)  In simpler terms x axis - Month y axis - Measure legend - Year and Service type ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Babu34,

     

    Power BI doesn’t let you use two separate legends (like one for Year and one for Service Type) in the same chart.

    But you can work around this by combining both into one as suggested by Royel . Just create a new column that joins Year and Service Type together, like this:

    YearService = FORMAT([RequestDate], "YYYY") & " - " & [ServiceType]

    This way, your legend will show values like "2023 - Type A" or "2024 - Type B", and you can compare them easily in one chart.

     

    Thanks & Regards,

    Prasanna Kumar

  • Royel's avatar
    Royel
    1 year ago

    Babu34 Lets try something new, We can create a "Dynamic Legend with Parameter" and use it in the visual. 

    Steps: 

    1. Go to Modeling tab → New parameter → Fields

    2. Add both "Year" and "ServiceType" fields to the parameter

    3. Ceates a slicer that allows users to switch between viewing by Year or by Service Type
    4. Now create a line or Clustered Column Chart where legend item is the new parameter. 
    Let me know how it goes.