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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Syndicate_Admin
Administrator
Administrator

Count rows of different columns according to an ID

Good to all,

I hope you can help me with the following problem, I have a table where there are 4 variables:

Store is where a product was purchased, ID of the person who bought it, Tool that was used during the purchase (in the case of Customer1 I buy 2 product and use an ipad, in the case of Customer 2, I do not use anything but if I buy 1 product) and Product purchased

Shop IDToolProduct
Shop 1Cliente1Ipad
Shop 1Cliente1 Product 1
Shop 1Cliente1 Product 2
Shop 1Cliente1
Shop 1Cliente2
Shop 1Cliente2 Product 1
Shop 1Cliente2
Shop 1Cliente2

I need to show in Power BI the following:

ShopUsing ToolProduct Sale with ToolNo use of Tool
Shop 1 111

I need to show by stores the times that the tool was used, of the cases that did use the tool, how many to buy some product and those who bought something but did not use the tool.

I hope you understand the question and your help, thank you very much!

1 ACCEPTED SOLUTION

Hi, @Syndicate_Admin 

 

You can try the following methods.

Column:

Use bought = 
Var maxproduct=CALCULATE(MAX('Table'[Product]),ALLEXCEPT('Table','Table'[ID]))
return
IF(maxproduct<>BLANK(),1,0)
Use tool = 
Var maxtool=CALCULATE(MAX('Table'[Tool]),ALLEXCEPT('Table','Table'[ID]))
return
IF(maxtool<>BLANK(),1,0)

Result:

vzhangti_0-1663148989244.png

Measure:

Clients who bought using a tool = 
CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),[Use bought]=1&&[Use tool]=1))
No use of Tool = 
CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),[Use tool]<>1))

Result:

vzhangti_1-1663149061125.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

Thank you very much for the answer, but I have a problem with the measure "Clients who bought using a tool" which is if a customer uses the ipad and I do not buy product, he tells me as if I use the product and buy, but I should not.

CamiAO98_0-1663095325022.png

CamiAO98_2-1663095343001.png

For example here instead of 3 I need to say 2

Hi, @Syndicate_Admin 

 

You can try the following methods.

Column:

Use bought = 
Var maxproduct=CALCULATE(MAX('Table'[Product]),ALLEXCEPT('Table','Table'[ID]))
return
IF(maxproduct<>BLANK(),1,0)
Use tool = 
Var maxtool=CALCULATE(MAX('Table'[Tool]),ALLEXCEPT('Table','Table'[ID]))
return
IF(maxtool<>BLANK(),1,0)

Result:

vzhangti_0-1663148989244.png

Measure:

Clients who bought using a tool = 
CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),[Use bought]=1&&[Use tool]=1))
No use of Tool = 
CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),[Use tool]<>1))

Result:

vzhangti_1-1663149061125.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Hi,

Share the link from where i can download the PBI file.


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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors