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

If condition in a filter function

Hi everyone!

 

I've got the following column:

 

FilteredColumn= 
COUNTROWS (
    FILTER (
        'Table1';
        'Table1'[Val1] = "0"
     && 'Table1'[Val2] = "Closed"
  && 'Table1'[Val3] < 16
    )
)

 

 

It's working fine, but now I've got an other filter that I don't know how to aply it.

 

I've go some new values, lets name them Val4, Val5 and Val6
What I need is to make the following condition:


If Val4 = 5 && Val5 = 2017, then I need to bring those values where Val6 is between 2 dates.

 

So, I will have 12 conditions in that if statement:

 

If Val4 = 1 && Val5 = 2017, then show me those values where Val6 is between Dec-16 and Jan 2017
If Val4 = 2 && Val5 = 2017, then show me those values where Val6 is between Jan-17 and Feb 2017
If Val4 = 3 && Val5 = 2017, then show me those values where Val6 is between Feb-17 and Mar 2017
and so on...


Is it possible to integrate that if statement, with the 12 conditions (one per month), in the "FilteredColumn" so I can get those values wich are:

Val1 = "0"
Val2 = "Closed"
Val3 < 16

If Val4 = 1 && Val5 = 2017, then show me those values where Val6 is between Dec-16 and Jan 2017

If Val4 = 2 && Val5 = 2017, then show me those values where Val6 is between Jan-17 and Feb 2017

If Val4 = 3 && Val5 = 2017, then show me those values where Val6 is between Feb-17 and Mar 2017

.. etc..

 

Hope you can undestand me, such as English is not my first language.

 

 

Kind regards!

1 REPLY 1
Moderator v-yuezhe-msft
Moderator

Re: If condition in a filter function

@chrisgehm,

It is difficult for us to provide you DAX based on the above description. Could you please share sample data of Table1 and post expected result in a table?

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 158 members 1,530 guests
Please welcome our newest community members: