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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
mmoreira7
Frequent Visitor

Count how many times a value appears with multiple conditions

Hello,

 

I am facing this problem and tried all the ways I can to solve it. I read so many info but cant get the result I want.

 

I want to build a visual or a table based on the info on the table below that shows how many times a "product_code" was selled with another "product_code" based on "process".

 

To better understand:

Process: like the number id of the sale

Product_code: number id of the product

 

For example:

 

powerbihelp.jpg

 

 

 

 

 

powerbihelp.jpg

 

I thank in advance to everyone that could help. 

 

If you need more information please just ask for it. I will be tottaly avaliable.

 

Thank you.

 

6 REPLIES 6
Greg_Deckler
Super User
Super User

Can you post sample/example data in text (not image) and also post your expected output for that data? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

 

First of all i want to thank you for your interest in helping me.

 

I read the article and I think i am doind correctly now.

 

If you need more information please just ask.

 

Thank you.

 

This is my data:

 

STORE_CODEPROCESSSEQ_NUMBEROPERATION_TYPEABS_NUMBERPRODUCT_CODE
21751676211175167621688
21751676212175167621174
21751676213175167621320
21751676214175167621606
1175167603117516760253
575167500117516749927
1175167365117516736468
21751672991175167299293
217516729921751672991580
21751672993175167299706
21751672994175167299649
21751672995175167299583
2175167299617516729926
21751672997175167409272
217516729981751676601
21751672999175167678447
21751672991017516769526270
11751672721175167272690
11751672722175167272740
11751672723175167314272
11751672724175167440360
117516727251751675521
5751672551175167255255
5751672552175167255341
57516725531751672551458
575167255417516725546
57516725551751675091
1175167222117516722126020
1175167222217516722125919
117516722231751672212304
117516722241751672211807
3751671961175167196203

 

What I want to get?

 

To know how many times a product code appears with another product code sharing the same process. 

 

This is the example of the information that i nedd (hand made):

 

PRODUCT_CODE126274653681742032552722933203413604475836066496886907067401458158018072304259192602026270
131 1    121 1111 1 11111    1
2611       11   11 1  1  1    1
27  1                          
461  1    1   1         1      
53    1                        
68     1                       
174      1    1    1 1          
203       1                     
2551  1    1   1         1      
272211      2   111 1 111 1    1
293111      1    11 1  1  1     
320      1    1    1 1          
3411  1    1   1         1      
3601        1   1     1 1       
44711       11   11 1  1  1    1
58311       11   11 1  1  1    1
606      1    1    1 1          
64911       11   11 1  1  1    1
688      1    1    1 1          
6901        1   1     1 1       
70611       11   11 1  1  1    1
7401        1   1     1 1       
14581  1    1   1         1      
158011       11   11 1  1  1    1
1807       1                1111 
2304       1                1111 
25919       1                1111 
26020       1                1111 
2627011       11   11 1  1  1    1

 

 

Thank you one more time.

Hi @Greg_Deckler, Did you had the chance to see this? Is in correct format now?

Thank you so much.

While not in a grid as you display, a meassure like:

 

Measure 10 = COUNTX(DISTINCT(Table21[PROCESS]),[PROCESS])

See Table 21, Page 12



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler.

 

Thank you so much for your time to help me.

 

So. I saw the solution that you sugested me. I think I cant get what I need from this measure. 

 

Lets see:

 

The measure that you sugested me will tell how many times a product appears in a distinct process. Am i right? This measure tells me that the product_code 1 appears 3 times.

 

What I need is "how many times the product_code 1 appears with others sharing the same process".

 

If I explain the final use maybe this could get easier. Our need is to see what products are selled with other products in the same purchase.

 

For example, I need to know how many times our costumer purchased the product_code 1 with the other codes in the same purchase (process = unique value for purchase ID).

 

What do you think? Did I missed something in your solution?

 

Thank you one more time!

 

 

 

 

Anyone could help me?

 

@Greg_Deckler did you had the chance to see this?

 

Thank you.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.