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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

how to sum value and splitting result into group to display in chart

Hello Everyone,

 

 I would like to create bar chart to display group of sum distance (Axis X)   and Count of truck in each group (Axis Y)
(Sum distance is vary depend on date range slicer  ex. single day  or  2-3 days)
(the result of sum distance of each truck is splitted in to group)

the result should be like this ( i made this in excel I dont know to to create visualize like this in BI)

JJ8098_0-1693211884657.png

example of slicer in BI

JJ8098_1-1693212193460.png

 

 

I have attach my Sample data in pbix file 

Sample pbix file 


please advice  Thank you very much.

 

Best Regards

JJ

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:
1. Enter data – create a table.

vyangliumsft_0-1693377233322.png

2. Create calculated table.

Flag =
 CROSSJOIN(
     'Table',
     DISTINCT('Sheet1'[Engine]))

vyangliumsft_1-1693377233325.png

3. Create calculated column.

Countof stuck =
SWITCH(
    TRUE(),
    'Sheet1'[Distance] <1000,"below 1000",
    'Sheet1'[Distance]  >=1000&&'Sheet1'[Distance] <2000,"1000",
    'Sheet1'[Distance]  >=2000&&'Sheet1'[Distance] <3000,"2000",
    'Sheet1'[Distance]  >=3000&&'Sheet1'[Distance] <4000,"3000",
    'Sheet1'[Distance]  >=4000&&'Sheet1'[Distance] <5000,"4000",
    'Sheet1'[Distance]  >=5000&&'Sheet1'[Distance] <6000,"5000",
    'Sheet1'[Distance]  >=6000,"6000 or more")

vyangliumsft_2-1693377262301.png

4. Create measure.

Flag_Meausre =
COUNTX(
    FILTER(ALLSELECTED(Sheet1),
    'Sheet1'[Engine]=MAX('Flag'[Engine])&&'Sheet1'[Countof stuck]=MAX('Flag'[Group])),[Countof stuck])

5. Result:

vyangliumsft_3-1693377262305.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Anonymous
Not applicable

Hello @Anonymous,

 

 As I check the result file you did  but the result in incorrect. number show on Axis Y should be distinct count and total value should not exceed 5  as the number of truck in data are  5 trucks in total.  from your visualization show total is 15 which is incorrect.

 

Please recheck again  and Thank you very much for your effort.

 

Best Regards 

jj

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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