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
Anonymous
Not applicable

Seaborn with powerBI

I am trying to quite simply plot a histogram containing the frequency at which a number occurs in my dataset. In a Juypter notebook I run 

 

sns.countplot(dataset['responseCode'])

 

And get the histogram I expect. However when I run the code in PowerBI, it sets everything to 1.0. Does anyone know why? 

1 ACCEPTED SOLUTION

hi @Anonymous 

For your case, just try this simple way:

Create a measure as below:

Measure = COUNTA('Table'[Response code])
Then create a bar visual as below:
2.JPG
 
and here is sample pbix file, please try it.
 
Regards,
Lin
Community Support Team _ Lin
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

10 REPLIES 10
parry2k
Super User
Super User

@Anonymous I'm not python/R developer, if you share sample data with expected output, I can help. Just to let you know, you can use R and Python visual in Power BI as well. 🙂



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Hi @parry2k 

The data will look something like

Response code

500

500

200

200

200

200

200

500

 

I want to count the number of times 500 or 200 appears. When I run in Juypter I get t.png

However when I run in powerBI, the same piece of code I get.

Screenshot (4).png

I dont know why its normalising to 1

hi @Anonymous 

For your case, just try this simple way:

Create a measure as below:

Measure = COUNTA('Table'[Response code])
Then create a bar visual as below:
2.JPG
 
and here is sample pbix file, please try it.
 
Regards,
Lin
Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @parry2k  @v-lili6-msft 

 

Thanks for both of your help. So i have the plot as shown by @v-lili6-msft But i dont want the spaces in between i really want it to be discrete catagories as shown in the seaborn plot above

Anonymous
Not applicable

Actually I have solved it. Just needed to switch to catagorial 🙂 

Thanks everyone will mark as solved

@Anonymous what is the aggregation on Value section of chart you used?

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

At the moment it is set to don't summerise. I tried changing to count and count distinct. It still gives me rubbish

@Anonymous it is not possible that you have dont summarize, in value section, it has to be some aggregation until your column is not number. 

Add following measure and use that in value 

Total Rows = COUNTROWS ( YourTable )

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

I dont really understand what you mean. I am new to powerbi, how do I add a measure?

 

 Screenshot (7).png

@Anonymous no worries, here it is

 

image.png



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.