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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
tyrhoku
New Member

Flag events that used certain products

I have a dataset that stores "events". Each event can have multiple records with the same ID. I want to be able to flag on that specific event ID when product A or product B were used in idividual columns.

 

Product A Flag = CALCULATE(
DISTINCTCOUNT('M1 Revenue Attributes & Measures'[Event ID]),
FILTER('D1 Product','[Product Type] = "A"))

 

Currently I can get an output like this

RegionEvent IDProduct TypeProduct A FlagProduct B Flag
US123AA1 
US123AB 1

 

End state I want to get to a table where I can show for each Event ID a flag for one A was used and when B was used. Should be a distinct count of that

RegionEvent IDProduct A FlagProduct B FlagTotal 
US123A112 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @tyrhoku ,

 

Is [Product A Flag] a measure and the output above a table visual? I think you can try to remove [Product Type] column in table visual and check the result. Due to I don't know your data model, I create a sample to have a test.

D1 Product:

RicoZhou_0-1650959959189.png

M1 Revenue Attributes & Measures:

RicoZhou_1-1650959964983.png

Relationship:

RicoZhou_2-1650960003608.png

Measures:

Product A Flag =
CALCULATE (
    DISTINCTCOUNT ( 'M1 Revenue Attributes & Measures'[Event ID] ),
    FILTER ( 'D1 Product', [Product Type] = "A" )
)
Product B Flag =
CALCULATE (
    DISTINCTCOUNT ( 'M1 Revenue Attributes & Measures'[Event ID] ),
    FILTER ( 'D1 Product', [Product Type] = "B" )
)
Total = [Product A Flag] + [Product B Flag] 

Result is as below.

RicoZhou_3-1650960142680.png

Best Regards,
Rico Zhou

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @tyrhoku ,

 

Is [Product A Flag] a measure and the output above a table visual? I think you can try to remove [Product Type] column in table visual and check the result. Due to I don't know your data model, I create a sample to have a test.

D1 Product:

RicoZhou_0-1650959959189.png

M1 Revenue Attributes & Measures:

RicoZhou_1-1650959964983.png

Relationship:

RicoZhou_2-1650960003608.png

Measures:

Product A Flag =
CALCULATE (
    DISTINCTCOUNT ( 'M1 Revenue Attributes & Measures'[Event ID] ),
    FILTER ( 'D1 Product', [Product Type] = "A" )
)
Product B Flag =
CALCULATE (
    DISTINCTCOUNT ( 'M1 Revenue Attributes & Measures'[Event ID] ),
    FILTER ( 'D1 Product', [Product Type] = "B" )
)
Total = [Product A Flag] + [Product B Flag] 

Result is as below.

RicoZhou_3-1650960142680.png

Best Regards,
Rico Zhou

 

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

 

amitchandak
Super User
Super User

@tyrhoku , try like this and check


Product A Flag = CALCULATE(
DISTINCTCOUNT('M1 Revenue Attributes & Measures'[Event ID]),
FILTER(all('D1 Product'[Product Type]),[Product Type] = "A"))

 

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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