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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
twowaysyellow
Frequent Visitor

Creating a calculated column that indicates count number of another column range

Apparently I'm completely missing something very basic, I have tried all morning - even being smashed around by ChatGPT :-).

 

I have a table with ticket_id's for every guest at certain events hosted by certain people.

 

I want to end up with a column that list a 1 or 0 for each ticket id indicating whether the seller/host of this ticket has more than 2 events on that particular day.

So, I have this.

ticket_idguest_iddateevent_idhost_id
1101/01/202311
2201/01/202321
3301/01/202331
4401/01/202311
5102/01/202341
6202/01/202341
7103/01/202351

 

And I want to add a column like this

ticket_idguest_iddateevent_idhost_id>2/day
1101/01/2023111
2201/01/2023211
3301/01/2023311
4401/01/2023111
5102/01/2023410
6202/01/2023410
7103/01/2023510

 

Then I want a visual that can display each event id that is part of a sequence where the host has more than 2 events per day. Baiscally removing all event_id where the host has 2 or less on a given day.

 

That means the above would give me something like this as a visual:

dateevent_idhost_id
01/01/202311
01/01/202321
01/01/202331
01/01/202311

 

It might be cool to sort out duplicate event_id's from that visual, but that's not necessary.

 

Thanks to everyone who can help.

1 ACCEPTED SOLUTION
twowaysyellow
Frequent Visitor

Thanks, it almost worked, but I managed to tweak it a bit with a little help. This is what ended up working: 

Column = if(CALCULATE(COUNTROWS(Table),ALLEXCEPT(Table,Table[host_id],Table[date]))>2,1,0)

View solution in original post

2 REPLIES 2
twowaysyellow
Frequent Visitor

Thanks, it almost worked, but I managed to tweak it a bit with a little help. This is what ended up working: 

Column = if(CALCULATE(COUNTROWS(Table),ALLEXCEPT(Table,Table[host_id],Table[date]))>2,1,0)

DOLEARY85
Super User
Super User

Hi,

 

try this:

 

Column = if(CALCULATE(COUNT('Table'[host_id]),ALLEXCEPT('Table','Table'[date]))>2,1,0)
 
basically it's counting the the host id but changing the context to only count against the exact date.
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.