cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
heytherejem Member
Member

Re: DAX Calculate IF OR Statement

@vyacheslavg I'm having trouble with this unless I'm going mad I have created a very simple calculate DAX measure with an or filter and it's not working properly. 

 

I know the result is:

1001 = 36

1002 = 13

both = 49

 

My measure is: 

Members follow up or regular appointment = CALCULATE(DISTINCTCOUNT('Appointments'[Member]),
FILTER(
    'Appointments',
    'Appointments'[Type]="1001"||'Appointments'[Type]="1002"))

And the measure result is 36.

 

HELP!

dtartaglia Member
Member

Re: DAX Calculate IF OR Statement

Hi @vyacheslavg DISTINCTCOUNT is expecting to return a single value in a calculated measure. What is the end result/visual you need the information in? This can easily be done in a table or other visuals without DAX.

 

Thanks,

Dan

heytherejem Member
Member

Re: DAX Calculate IF OR Statement

@dtartaglia Hi, so the distinctcount is counting unique instances of a member id, where the appointment type for the same row is 1001 or 1002.

This is because there are hundreds of appointments for each member and I want to count unique members who have had at least one appointment. 

 

Thanks!

Jemma

Highlighted
dtartaglia Member
Member

Re: DAX Calculate IF OR Statement

Hi  @vyacheslavg,

 

I'm using a very similar DAX measure in Desktop with slightly different syntax. I seem to get the correct number (created around 50 records). Please let me know if I'm missing something:

 

Members follow up or regular appointment = CALCULATE(DISTINCTCOUNT(Appointments[Members]), FILTER(Appointments, Appointments[Type] = "1001" || Appointments[Type] = "1002"))

 

DAXIssue.PNG

heytherejem Member
Member

Re: DAX Calculate IF OR Statement

Hi @dtartaglia 

 

No, you're not missing something - I was. Clearly, I have members with an appointment with BOTH codes hence it's not adding the 13 and 36 exactly. I was expecting 49 but your example shows me what is actually happening here. 

 

Thank you so much, I really appreciate it! 🙂 

Jemma

FrAspro95 Frequent Visitor
Frequent Visitor

Re: DAX Calculate IF OR Statement

Lets say both values "renewal" and "needs assignment" are in column A,
is there a way to mention both values in the filter (or anywhere else) without haviing the mention Table [column a] twice?

so instead of:

Table[Column A] = "Renewal" ||

Table[Column A] = "Needs Alignment"

 

Something like:

Table[Column A] = ("Renewal" || "Needs Alignment")

 

tried creating a VAR to return into my logical function but I dont get it right somehow

 

Any ideas? @KHorseman 

Super User I
Super User I

Re: DAX Calculate IF OR Statement

@FrAspro95  Table[Column A] IN {"Renewal", "Needs Assignment"}


Did I answer your question? Please mark it as a solution.

Proud to be a Datanaut!

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors
Top Kudoed Authors