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
Kumar11109
Helper IV
Helper IV

Histogram custom bins

Hi everyone, I am new to power bi and I am stuck. I need to create time spent bins for a histogram. How should I create bins like >2, 2-4, 4-6 , 6-8... Etc. Please help its urgent....

Screenshot (61).png


You see that I have already added the time spent for session using the calculate formula. Which is as follows: 

 

Calculate(Sum(VW_GRoupScoreP4(MinutesSpent),AllExcept(VW_GroupScoreP4,VW_GRoupScoreP4(SessionID)). 

 

I hope this formula is correct to find total time spent in each session. 

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi, @Kumar11109

There will be a menu when you click “1”, choose “New Group”, then you can see scene “6”. Let Group type be “Bin”, then choose Bin size as 2. As you can see the data in “5”, all the data group by 2 or whatever you want (>2, 2-4, 4-6 , 6-8).
Ps:  1. The axis and the value are the same column “Total Time Spent”.

      2. Reference: https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-grouping-and-binning/

Histogram custom bins.jpgHistogram custom bins02.jpg

Community Support Team _ Dale
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

15 REPLIES 15
asitm
Helper III
Helper III

I believe the free Microsoft visual is not available anymore. Though there are other custom visuals available for Histogram in appsource now, and those have the options to customize bin easily. Some paid and some free, but the free ones have more limitations.

 

https://appsource.microsoft.com/en-us/product/power-bi-visuals/histogramstd

 

asitm_0-1696568869138.png

 

 

v-jiascu-msft
Employee
Employee

@Kumar11109

 

Hi,

Could you share your method here please? That would be very helpful to others.

 

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jiascu-msft
Employee
Employee

Hi, @Kumar11109

There will be a menu when you click “1”, choose “New Group”, then you can see scene “6”. Let Group type be “Bin”, then choose Bin size as 2. As you can see the data in “5”, all the data group by 2 or whatever you want (>2, 2-4, 4-6 , 6-8).
Ps:  1. The axis and the value are the same column “Total Time Spent”.

      2. Reference: https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-grouping-and-binning/

Histogram custom bins.jpgHistogram custom bins02.jpg

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I used this method only to create groups. But rather than doing it in the same table that had all the data, I created another table using the function "Summarise". That helped me get only the data that I required for the table. Then method worked. Remember I wanted time spent for each session, and my original table had multiple values consisted of multiple values as each session consisted of multiple resources being watched in a session. I created another table with session id with total time spent on all the resources being watched in that specific session. 

 

Thank You, 

Dale

@Kumar11109

 

Hi,

Thank you for sharing your method with us!

 

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

What are groups ??  

Hi, @Kumar11109

 

Don't you want to create bins? Bins is a kind of group. Such as 0-2, 2-4, 4-6... You can see the "Group Type" is "Bin". If not so, please clarify your needs. Like what the histogram is.

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I was able to create a histogram with the process that you said. But there is another problem that I am facing. There are multiple sessions. I am attaching an image of an excel. You can see below that for each session that students have seen multiple resources. And for each resource, there is time spent given in column 3. Now in the 4th column each for each session there is total time, which is the sum of time spent on each resource. Now with your method, the time spent is taking the duplicate values of each session and not removing them. Keep one thing in mind that I don't want to remove the duplicate values because I would require them for different calculations. 

 

Thank you for your help!!! 😄

 

Screenshot (73).png

 

Hi, @Kumar11109

 

Maybe you want to display every session in the visual. We can use "Time Spent" directly and leave "Total Time spent" alone. There are no duplicate values now. The visual below is created with your new data. Maybe this could be a little help.Histogram custom bins03.jpg

 

 

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

If you look at the histogram, you see that time spent for session 4 and 5 is actually 23 and 15 respectively and not 6. The x-axis should be based on total time spent in a session. I can't seem to find a way to do it. Is there a code in DAX that can help me do this?? 

 

 

What's for the y-axis (and/or legend)?

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I have done the same thing that you have done. The y-axis is giving is the sum of minutes. 

 

 

Hi @Kumar11109,

 

Maybe this is what you want. If not, could you please create a sample visual with excel.Histogram custom bins04.jpg

 

 

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I used another method, in which I created another table and then used it to create the histogram. 

Thanks BTW. 

You are welcome. I am so glad you got it done.

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.