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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Create a column based on a measure

Hi experts,

 

Having this table (this is a portion of a huge table):

 

IdSportevent
User1Sport1Event1
User2Sport1Event2
User3Sport2Event3
User3Sport2Event4
User3Sport2Event5
USer3Sport2Event6
User4Sport3Event7
User4Sport3Event8
User5Sport2Event9
User6Sport4Event10
User6Sport4Event11
User6Sport4Event12
User6Sport4Event13
User6Sport4Event14
User6Sport4Event15
User3Sport1Event1
User3Sport1Event5

 

I want to create a table like this:

Sport1  
 QtEventsUsers
 12
 21
 30

 Sport would be the filter, and I want to get the number of users who belongs to an event. In this case, User3, belongs to 2 events [Event1, Event5]; User1 belongs to 1 event [Event1] and User2, belongs to one event [Event2].

I have an idea about what I want to do, but can't translate it to DAX.

 

 

1. Count of Id.

2. Count of rows, form the previous step.

 

with this steps, I can get something like

 

Sample.png

From this, I want to apply step 2, in this way, I think I could create the result table with. This can be read to something like, user1 and user2, belong to 1 Event; User3, belongs to 2 events.

Please see the atached file here!

 

 Any suggestion?

1 ACCEPTED SOLUTION

Hi @Anonymous

Create a column
count of events for each user =
CALCULATE (
    DISTINCTCOUNT ( Eventos[event] ),
    FILTER (
        ALLEXCEPT ( Eventos, Eventos[Sport] ),
        Eventos[Id] = EARLIER ( Eventos[Id] )
    )
)
Create a measure
count of Users =
CALCULATE (
    DISTINCTCOUNT ( Eventos[Id] ),
    FILTER (
        ALLSELECTED ( Eventos ),
        Eventos[count of events for each user]
            = MAX ( Eventos[count of events for each user] )
    )
)
Capture7.JPG

 

Best Regards
Maggie
Community Support Team _ Maggie 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

4 REPLIES 4
amitchandak
Super User
Super User

Check this file

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

The final table you want is not very clear.  Add a few tables.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks for your response @amitchandak .

 

When I select Sport1, the output table should be:

QtEventsQtUsers
12
21
30
40
50
60

 

Sport2:

QtEventsQtUsers
11
20
30
41
50
60

 

Sport3:

QtEventsQtUsers
10
21
30
40
50
60

 

Sport4: 

QtEventsQtUsers
10
20
30
40
50
61

 

Thanks

Hi @Anonymous

Create a column
count of events for each user =
CALCULATE (
    DISTINCTCOUNT ( Eventos[event] ),
    FILTER (
        ALLEXCEPT ( Eventos, Eventos[Sport] ),
        Eventos[Id] = EARLIER ( Eventos[Id] )
    )
)
Create a measure
count of Users =
CALCULATE (
    DISTINCTCOUNT ( Eventos[Id] ),
    FILTER (
        ALLSELECTED ( Eventos ),
        Eventos[count of events for each user]
            = MAX ( Eventos[count of events for each user] )
    )
)
Capture7.JPG

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.