Forum Discussion
undefined
- Anonymous1 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
- 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.
Hi Babu34 , you can achieve this by choosing a Clustered Column Chart
Steps:
- Create a calculated column: Year_ServiceType = [Year] & " " & [ServiceType]
- Drag Month to X-axis
- Drag Request Count to Values
- Drag the new Year_ServiceType field to Legend
This will give you clustered bars for each month, with different colors representing each year-service combination.
If you find this helpful please mark my post as the solution, it helps others with the same challenge find the answer!