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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
OskariNi
Helper I
Helper I

Clusterd bar chart using 2 x-axis columns

Hi all, 

 

I would like to combine these 2 charts into 1 clustered chart. The problem is that they use different columns for the week values (x-axis). Is this possible with power BI?

 

Capture4.PNG

Capture3.PNG

 

Thanks, Oskari

2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @OskariNi,

 

Make a Dimension table with Week and then make the relatioship between this table and the Open and Close date be aware that for this two relationships you need to make inactive relationships.

 

Then create two measures like this:

 

Opened = CALCULATE ( COUNT(Table[Open Week]); USERELATIONSHIP(Table[Open Week]; Week[Week])


Closed= CALCULATE ( COUNT(Table[Closed Week]); USERELATIONSHIP(Table[Closed Week]; Week[Week])

 

Then create your chart using the table from the week column in the axis and both measures on values.

 

week.gif

 

Be aware that your week table probably should be YearWeek and not only week.

 

Regards,

MFelix

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

Hi @OskariNi,

 

One best practice is to create a Dimension table for Dates making use of all the hierarchies trhough that table, this is applicable when you have several tables or fields within the same table that you need to connect by date field.

 

Check this example or search for DimDate / Calendar in Power BI models, you will get several examples then you just need to implement the solution I have refer.

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

6 REPLIES 6
CosminIr
Frequent Visitor

Hi all,

 

I want also to combine 2 charts into one. The first one is filtered by the shop and the second is not filtered. I'm new to Power Bi 🙂 Please help.

Capture1 PBI Help.PNG

Thanks for your time.

Cosmin

MFelix
Super User
Super User

Hi @OskariNi,

 

Make a Dimension table with Week and then make the relatioship between this table and the Open and Close date be aware that for this two relationships you need to make inactive relationships.

 

Then create two measures like this:

 

Opened = CALCULATE ( COUNT(Table[Open Week]); USERELATIONSHIP(Table[Open Week]; Week[Week])


Closed= CALCULATE ( COUNT(Table[Closed Week]); USERELATIONSHIP(Table[Closed Week]; Week[Week])

 

Then create your chart using the table from the week column in the axis and both measures on values.

 

week.gif

 

Be aware that your week table probably should be YearWeek and not only week.

 

Regards,

MFelix

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank's @MFelix,

 

This works but I lose the hierarchy I have with the weeks (Dates, type etc...). 

Hi @OskariNi,

 

Does the hierarchies you have is in a separate table or in the same table?

 

If it's in a separate table you should use that table and make the USERELATIONSHIP and the inactive connection with the column that isn't connected yet.

 

You don't have a lot of information about your model so it's difficult to give more than a generic answer that needs to be adapted, can you share a PBIX or a sample data and expected result?

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix

 

The hierarchies (date and type) are in the same table (small part of the table in the first post). I can't share my pbix but perhaps I can generate a similar sample data for you. 

Hi @OskariNi,

 

One best practice is to create a Dimension table for Dates making use of all the hierarchies trhough that table, this is applicable when you have several tables or fields within the same table that you need to connect by date field.

 

Check this example or search for DimDate / Calendar in Power BI models, you will get several examples then you just need to implement the solution I have refer.

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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