cancel
Showing results for
Did you mean:
Frequent Visitor

## Count items in category and view as a clustered column chart

Hi,

I managed to compute the Excel data below to show in the following Matrix table in PowerBI.

However, I would like to output into the below table so that I can create a clustered column chart to view the type of vehicles (and the no. of times) that each person uses in each month.

I've tried to create a couple of measures with distinctcount but it just won't give the correct count.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support Team

## Re: Count items in category and view as a clustered column chart

Hi @Dante79,

After test with your data, I modify my formula to use distinct date count to calculate total use amount.

```Usage Count =
CALCULATE (
DISTINCTCOUNT ( cars[Date] ),
ALLSELECTED ( cars ),
VALUES ( cars[Name] ),
VALUES ( cars[Type] ),
VALUES ( cars[Date] )
)
```

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
8 REPLIES 8
Frequent Visitor

## Re: Count items in category and view as a clustered column chart

Any help is much appreciated ! 🙂

Community Support Team

## Re: Count items in category and view as a clustered column chart

Hi @Dante79,

You can try to use below measure formula if it works for your requirement:

```Count of Type =
CALCULATE (
COUNT ( Table[Type] ),
ALLSELECTED ( Table ),
VALUES ( Table[Name] ),
VALUES ( Table[Type] ),
VALUES ( Table[Date] )
)
```

If above not help, please share some sample data or pbix file for test.

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
Frequent Visitor

## Re: Count items in category and view as a clustered column chart

Thanks.

But the measure produced an error 'Too many arguments were passed to the COUNT function. The maximum argument count for the function is 1.'

I've attached some sample data here
https://1drv.ms/f/s!ArkMmgaHDZU7lBnOZpnQvBgxATSl

Frequent Visitor

## Re: Count items in category and view as a clustered column chart

Ok the measure went through successfully but it is still not giving the correct results in the chart.

For example, Vicky (September) should be showing as count=1 for Van.

Frequent Visitor

## Re: Count items in category and view as a clustered column chart

I've been spending hours just trying to figure this out. I'm sure it's a very basic thing for many but really struggling to get this to work. Appreciate any help or someone to point me towards a direction please !

Thanks !

Frequent Visitor

## Re: Count items in category and view as a clustered column chart

Bump

Highlighted
Community Support Team

## Re: Count items in category and view as a clustered column chart

Hi @Dante79,

After test with your data, I modify my formula to use distinct date count to calculate total use amount.

```Usage Count =
CALCULATE (
DISTINCTCOUNT ( cars[Date] ),
ALLSELECTED ( cars ),
VALUES ( cars[Name] ),
VALUES ( cars[Type] ),
VALUES ( cars[Date] )
)
```

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
Frequent Visitor

## Re: Count items in category and view as a clustered column chart

Great ! It works ! Thanks so much !!!

Announcements

#### Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

#### Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

#### January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors
Top Kudoed Authors