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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
RasDev1
Frequent Visitor

Need to change the category and counts

Hi all,

I need help finding a solution for the following:

I have a table called "tickets," and one license plate can have multiple tickets. I need to categorize the counts, such as "Number of license plates having 1 ticket" (see attached image).

How can I achieve this? If I filter the dates, the value should change according to the specific time period.

Additionally, I have created two columns for this purpose.

Please let me know how to proceed


1)

Recurring Licenceplate count =
CALCULATE(
    COUNT('tickets'[id]),
    FILTER(
        'tickets',
        'Tickets'[License Plate] = EARLIER('Tickets'[License Plate])
    )
)
2) 
Recurring Category =

IF([Recurring Licenceplate count] = 1, "No of licence plate having 1 ticket",
IF([Recurring Licenceplate count] = 2, "No of licence plate having 2 tickets",
IF([Recurring Licenceplate count] = 3, "No of licence plate having 3 tickets",
IF([Recurring Licenceplate count] = 4, "No of licence plate having 4 tickets",
IF([Recurring Licenceplate count] = 5, "No of licence plate having 5 tickets",
IF([Recurring Licenceplate count] > 5, "No of licence plate having more than 5 tickets"

))))))



RasDev1_0-1731396281784.png

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

I have answered a similar question in the attached file.

Hope this helps.


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

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

I have answered a similar question in the attached file.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @RasDev1 

 

Thanks for the reply from SamWiseOwl .

 

The following is for your reference:

 

My sample:

vxuxinyimsft_0-1731476820336.png

 

Create a measure as follows

Recurring Licenceplate count = 
CALCULATE(
    COUNT('tickets'[id]),
    FILTER(
        'tickets',
        'tickets'[License Plate] = MAX('tickets'[License Plate]) && 'tickets'[Date] IN VALUES(tickets[Date])
    )
)

 

Recurring Category = SWITCH(TRUE(),
[Recurring Licenceplate count] = 1, "No of licence plate having 1 ticket",
[Recurring Licenceplate count] = 2, "No of licence plate having 2 tickets",
[Recurring Licenceplate count] = 3, "No of licence plate having 3 tickets")

 

Output:

vxuxinyimsft_1-1731477232543.png

 

vxuxinyimsft_2-1731477272341.png

 

If you need to dynamically change the data based on the slicer, you need to use measure, but measure will be affected by the context of the visualization, so you need to put the [License Plate] column used in the formula into the visualization.

 

Best Regards,
Yulia Xu

 

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

when i remove a licence plate it look like this

RasDev1_0-1731753824473.png

but i need each categorize wise,
like no of licence plate having 1 ticket ,2 ticket,3 ticket,.. more then 5 ticket

Thank you for sharing this, but I need it to display as shown in the reference image. The count should represent unique license plate counts.

RasDev1_0-1731484832528.png


any possible solution for this?

 

SamWiseOwl
Super User
Super User

Hi @RasDev1 

First create a table with those values listed out:

SamWiseOwl_0-1731397475097.png

 

Put this into your table visual with a measure like this:

Count Tickets =
var licencetable =
SUMMARIZE('tickets','tickets'[licenceplate], "Count licence", DISTINCTCOUNT(tickets[ticket id]))

var final =
SWITCH(
    SELECTEDVALUE('Ticket Table'[Number of tickets])
    ,"Num 1" , COUNTROWS(FILTER(licencetable, [Count licence] = 1))
    ,"Num 2" , COUNTROWS(FILTER(licencetable, [Count licence] = 2))
    ,"Num 3" , COUNTROWS(FILTER(licencetable, [Count licence] = 3))
    ,"Num 4" , COUNTROWS(FILTER(licencetable, [Count licence] = 4))
    ,"Num 5" , COUNTROWS(FILTER(licencetable, [Count licence] = 5))
    ,COUNTROWS(FILTER(licencetable, [Count licence] > 5))
) RETURN final
 
It should look something like this:
SamWiseOwl_1-1731398235826.png

 

 


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Thank you for sharing this, but I need it to display as shown in the reference image. The count should

when i change a date slicer filter it should be dynamically change,

any possible solution for this?

Hi @RasDev1 

Did you try it?

It is dynamically changing on mine.

Measures can be recalculated on the fly.


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Helpful resources

Announcements
Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.