cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mclaur_and_22
Frequent Visitor

Help with DAX for double group count and sum

Hi eveybody, 

 

I'm recently new to PowerBI and its calculated measures and I'm currently having problems with a DAX that I want to create: I have a table with several columns, but the ones I wanted to group were a reference ID (the Id of costumer) called REFERENCIA, the Id of a product (called ENLACE) and the code for a failure ticket for each product (called TICKET). So a costumer can have several products (and the code of the product is not unique, so several costumers can have the same product) and a product can have several failure tickets. 

The data can be seen as follows (like there is only one product that have more than 1 ticket then I would take this only product for the total calculation): 

EVID2.png 

So I would expect something like (based on the previous table): 

 

Total_count_products=1 

 

What I would like to have is a DAX measure where I can count the number of Id products (based on its reference) that have more than 1 failure ticket generated (like to know which products have recurrent failures). So far, I have able to count the number of unique products for each customer, however I don´t know how to do this taking into account the number of ticket per products. 

The measure I was able to get is: 

 

Medida = CALCULATE(COUNTROWS(Table),DISTINCT(Table[Enlace))

 

 

I have shared a pbix file where you can see more info: pbix file 

Thanks in advance 

 

1 ACCEPTED SOLUTION

Hi, @mclaur_and_22 

 

You can try:

Count = COUNTROWS(filter(SUMMARIZE(Inf_fallas,[REF],[ENLACE],"count",COUNT(Inf_fallas[ENLACE])),[count]>1))

 

vjaneygmsft_0-1643081373864.png

Did I answer your question? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.

Best Regards,
Community Support Team _ Janey

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@mclaur_and_22 , Create two measures like

 

cnt = COUNTROWS(Table)

 

countx(filter(Values(Table[Enlace]), [cnt] >1), [Enlace])



New Power BI Features
Datamarts: https://youtu.be/8tskWsJTEpg
Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin !! Proud to be a Super User!
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
!! Subscribe to my youtube Channel !!

Hi @amitchandak, thank you for replying, I have use your formulas and what I get is the total count of costumers that have more than 1 product, instead of the total acount of products (per costumer) that have more than 1 ticket. 

 

EVID4.png

As you can see, the measure give me a total sum of 3, which would the number of references that have more than 1 product, according to the table the total sum should be two, because two products of all the products listed presented more than 1 ticket. 

 

Thank you!! 

Hi, @mclaur_and_22 

 

You can try:

Count = COUNTROWS(filter(SUMMARIZE(Inf_fallas,[REF],[ENLACE],"count",COUNT(Inf_fallas[ENLACE])),[count]>1))

 

vjaneygmsft_0-1643081373864.png

Did I answer your question? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.

Best Regards,
Community Support Team _ Janey

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors