Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vjnvinod
Impactful Individual
Impactful Individual

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

Hi Experts,

@Anonymous 

 

@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!


@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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.