cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tobiasnygren
Helper II
Helper II

Count % of tickets with only one appointment.

 

Hi!
I need help with how to write the dax code for how to
 - count number of tickets that only have one appointment in the detail table
 - count number of ticket that have more than one appointment in the detail table
 - count number of tickets that do not exist in the detail table

I don't get it to work correct.


See example in the picture.

 

Example.png

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User IV
Super User IV

So, should be something like:

 

Number with only 1 =
  VAR __Table = 
    GROUPBY(
      'Table',
      [Ticket No],
      "Count",COUNTX(CURRENTGROUP(),[Schedule date])
    )
RETURN
  COUNTROWS(FILTER(__Table,[Count] = 1))

Should all be a variation of that.


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Greg_Deckler
Super User IV
Super User IV

So, should be something like:

 

Number with only 1 =
  VAR __Table = 
    GROUPBY(
      'Table',
      [Ticket No],
      "Count",COUNTX(CURRENTGROUP(),[Schedule date])
    )
RETURN
  COUNTROWS(FILTER(__Table,[Count] = 1))

Should all be a variation of that.


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Works perfect!
I really appreciate your quick help.

Thank you very much!

Anytime @tobiasnygren !

---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power BI User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

March Update

Check it Out!

Click here to read more about the March 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors