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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
CMaxwell
New Member

How to summarize a table showing total days by number of vehicles needed

Self-taugh and new to Power BI.  No experience with measures, not sure if one is needed here, but I wanted to see if someone could help.  

 

I have a report that shows total number of vehicles needed by date for my organization.  I am trying to summarize the data to show the total number of days associated with each distinct count of vehicle need. 

 

For example: how many total days were 12 vehicles needed, how many total days were 11 vehicles needed, etc...  I have this information presented in a table in my report, but I would like to show the summary results where the vehicle count shows on the x-axies and the total days shows on the y-axis.  I've included a visual from an old excel report I used to use below the table for reference.  

 

Is there a way I can summarize the number of days by vehicle need to show in a column chart?

 

CMaxwell_2-1729196660825.png

CMaxwell_3-1729197002349.png

 

Thank you.

1 ACCEPTED SOLUTION
v-denglli-msft
Community Support
Community Support

Thanks for SachinNandanwar and Ashish_Mathur's concern about this issue.

Hi @CMaxwell ,


I am not sure how your source dataset is designed, below is my example.

 

Below is my source dataset.

vdengllimsft_0-1729479008134.png

Vehicle count table

vdengllimsft_2-1729479336711.png

 

Add the following measure to the Y-axis of the column chart.

Total days based on vehicle needs = 
VAR _tb =
    SUMMARIZECOLUMNS ( 'Table'[Dirve Date], "Count", COUNT ( 'Table'[Drive ID] ) )
RETURN
    COUNTX (
        FILTER ( _tb, [Count] = SELECTEDVALUE ( 'Vehicle count'[Count] ) ),
        'Table'[Dirve Date]
    )

 

The end result is as follows and hopefully meets your needs.

vdengllimsft_3-1729479621915.png


Please see the attached pbix for reference.

Best Regards,
Dengliang Li

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

3 REPLIES 3
v-denglli-msft
Community Support
Community Support

Thanks for SachinNandanwar and Ashish_Mathur's concern about this issue.

Hi @CMaxwell ,


I am not sure how your source dataset is designed, below is my example.

 

Below is my source dataset.

vdengllimsft_0-1729479008134.png

Vehicle count table

vdengllimsft_2-1729479336711.png

 

Add the following measure to the Y-axis of the column chart.

Total days based on vehicle needs = 
VAR _tb =
    SUMMARIZECOLUMNS ( 'Table'[Dirve Date], "Count", COUNT ( 'Table'[Drive ID] ) )
RETURN
    COUNTX (
        FILTER ( _tb, [Count] = SELECTEDVALUE ( 'Vehicle count'[Count] ) ),
        'Table'[Dirve Date]
    )

 

The end result is as follows and hopefully meets your needs.

vdengllimsft_3-1729479621915.png


Please see the attached pbix for reference.

Best Regards,
Dengliang Li

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

 

 

 

Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
SachinNandanwar
Super User
Super User

You can try the SUMMARIZE or SUMMARIZECOLUMN function

https://www.sqlbi.com/articles/introducing-summarizecolumns/



Regards,
Sachin
Check out my Blog

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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