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
Minakshi
Resolver I
Resolver I

stacked chart

Screenshot from 2020-07-24 12-45-30.png

 

Hello All,

I want to plot stack charts as shown in figure. I have 4 columns having values 0 and 1. I want to stack count of zeros on count of ones. Kindly help.

Thanks

2 ACCEPTED SOLUTIONS

Hi @Minakshi ,

 

Consider the following Input Data:

Pragati11_0-1595580899197.png

 

Go to Query Editor, Select both the columns and Unpivot columns under Transform tab:

Pragati11_1-1595580982646.png

 

You will end up with the following:

Pragati11_2-1595581018232.png

 

Close and Apply changes and try creating a chart as follows:

Pragati11_3-1595581101460.png

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

Fowmy
Super User
Super User

@Minakshi 

Add an Index column and Unppivot your data then add two-measure

Ones = CALCULATE(COUNTROWS('Table'),'Table'[Value]=1)

Zero = CALCULATE(COUNTROWS('Table'),'Table'[Value]=0)


DOWNLOAD the file:
https://1drv.ms/u/s!AmoScH5srsIYgYIiPWtugR6FM5NxLg?e=2Y9TQM

 

Fowmy_0-1595581322717.png

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

I accept KUDOS 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

12 REPLIES 12
Fowmy
Super User
Super User

@Minakshi 

Add an Index column and Unppivot your data then add two-measure

Ones = CALCULATE(COUNTROWS('Table'),'Table'[Value]=1)

Zero = CALCULATE(COUNTROWS('Table'),'Table'[Value]=0)


DOWNLOAD the file:
https://1drv.ms/u/s!AmoScH5srsIYgYIiPWtugR6FM5NxLg?e=2Y9TQM

 

Fowmy_0-1595581322717.png

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

I accept KUDOS 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy @Pragati11 Is there any other way to do it? I don't want to unpivot data as I have more visuals to make with the same data. 

Hi @Minakshi ,

 

You can create a Refrence table to your actual table in Query editor and use for this chart (following un-pivot steps) and keep the original table in case you need it.

 

But if I see unipvoted data should be able to be used for any charts that you are trying to do.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

@Pragati11 , @Fowmy  will slicers work on charts which are coming from refernce query? field of slicer is coming from pivot table.

Thanks

@Fowmy @Pragati11 Thanks a lot. Your response was really quick. 

@Minakshi 

 

Tou will need to create relationships between the new referenced table or use measures that use this table. 

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

I accept KUDOS 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Minakshi 

 

The advantage of having your data unpivoted in this way will support you in almost any visuals as it's normalized.  better stick to that. 

If you really need it your way, then create a reference query in power query  and unpivot. You can use for this visual as well as others when necessary 

 

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

I accept KUDOS 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Pragati11
Super User
Super User

Hi @Minakshi ,

 

Please share some sample data. It's hard to answer you query.

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Fowmy
Super User
Super User

@Minakshi 

Please share some sample data in the layout that is supposed to be used for the chart you desire.

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

I accept KUDOS 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy , @Pragati11  data is just like this

OSAPlanolocationfacing 
0101
1101
0111
1011

 

I want to show no of zeros and no of one stacked on each other for each colum.

 

Thanks

Hi @Minakshi ,

 

Consider the following Input Data:

Pragati11_0-1595580899197.png

 

Go to Query Editor, Select both the columns and Unpivot columns under Transform tab:

Pragati11_1-1595580982646.png

 

You will end up with the following:

Pragati11_2-1595581018232.png

 

Close and Apply changes and try creating a chart as follows:

Pragati11_3-1595581101460.png

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

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.