cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vjnvinod
Post Prodigy
Post Prodigy

Need help with Dax, so that True will filter the max of the week number

Hi Experts,

@sreenathv 

 

@vanessafvg 

 

@PhilipTreacy 

I am using below DAX,

 

Curnt Mnth -1 Wk Weitg =
'People Flash Consolidated'[Period] = "MTD"
    && (
        'People Flash Consolidated'[Month Rank]
            MAX ( 'People Flash Consolidated'[Month Rank] ) - 1
    )
    && MAX ( 'People Flash Consolidated'[Weeknumber] )

 

i was expecting that,  True will only show the Max of the week number, but its showing all the week number, see below, Can someone please help to tweak this Dax, so that in that when i filter for True, it shows only Max of the week number

 

vjnvinod_0-1632557418496.png

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @vjnvinod 

Download this sample PBIX file

Your code is working, it's your data that is returning False because there aren't any rows where all 3 of those conditions are True.

If you create a separate column for each of your conditions - as I've done in the sample PBIX file I linked to above - you'll see that when you filter MTD to show only True, then filter MAX_Month_Rank to show only True, the only value left in MAX_Weekenumber is False.

Therefore your data does not contain any rows where your 3 conditions are True.

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

6 REPLIES 6
PhilipTreacy
Super User
Super User

Hi @vjnvinod 

Download this sample PBIX file

Your code is working, it's your data that is returning False because there aren't any rows where all 3 of those conditions are True.

If you create a separate column for each of your conditions - as I've done in the sample PBIX file I linked to above - you'll see that when you filter MTD to show only True, then filter MAX_Month_Rank to show only True, the only value left in MAX_Weekenumber is False.

Therefore your data does not contain any rows where your 3 conditions are True.

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

@PhilipTreacy 

 

I think i found why my code was not returning it correctly, there was issue with the code

below is how it should have been, but thank you so much for your help with this

Curnt Mnth -1 Wk Weitg =

'People Flash Consolidated'[Period] = "MTD"

    && (

        'People Flash Consolidated'[Month Rank]

            = MAX ( 'People Flash Consolidated'[Month Rank] ) - 1

    )

    && 'People Flash Consolidated'[Weeknumber]

        = 'People Flash Consolidated'[Currentweek]-1

PhilipTreacy
Super User
Super User

Hi @vjnvinod 

I'm not understanding what you are trying to do, can you please share your data/PBIX file.

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


@PhilipTreacy 

 

I am trying to create a filter calculated coloumn

that means if 

People Flash Consolidated'[Period] = "MTD"and 

People Flash Consolidated'[Month Rank] is previous month and

People Flash Consolidated'[Weeknumber] =current week,

for this output should be true, else false

 

The below Dax what i am using is helping me with first 2 condition but not the 3rd one

Its basically not reading the 3rd argument

MAX('People Flash Consolidated'[Weeknumber])

 

People Flash Consolidated'[Period] = "MTD"
    && (
        'People Flash Consolidated'[Month Rank]
            MAX ( 'People Flash Consolidated'[Month Rank] ) - 1
    )
    && MAX ( 'People Flash Consolidated'[Weeknumber] )

 

 

Hi @vjnvinod 

Your 3rd test condition isn't actually testing anything.  Your just saying return MAX ( 'People Flash Consolidated'[Weeknumber] ).

You need to do something like 

'People Flash Consolidated'[Weeknumber] = MAX ( 'People Flash Consolidated'[Weeknumber] )

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


@PhilipTreacy 

Output is coming as false, not sure why is it reading it that way?

i have attached the sample and filtered it, where i was expecting as output true

vjnvinod_0-1632564100178.png

 

Highly appreciate any help on this

https://drive.google.com/file/d/1LimuMp8Dz90ej5Uo7wKxdldYC9n9kUfZ/view?usp=sharing

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!