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
kressb
Helper V
Helper V

Override Slicer for 1 Column in Matrix

Hello,

I've tried to google/search the subject of this post - haven't found what I'm looking for.

If I missed it and someone has a link, please share!

I have a slicer at the top of my page:

kressb_0-1632487094681.png

I want the slicer to act on every column in my matrix except one:

LocationNumber1Oct20Number2Oct20Number3Oct20Number3Apr21
North 14-3-2 
South23-0.5-0.50 
East12-1.30-1.10 
West8-0.090.00 

 

Number3Apr - is supposed to be the furthest "future" number we have available in the system.

Without the Slicer on the page, I would have written a Dax Measure as follows:

Calculate (sum (Table1[Number3]), Filter(Table1, Table1[Date] = Max (Table1[Date])))

 

This almost gets me there:

Calculate(

                Sum (Table1[Number3]), 

                All (Table1),

                Filter(Table1, Table1[Date] = Max (Table1[Date]))
                )

But it takes away the Row Context (ie same number for every location).

Is there any way to write it and get the Location Context?

 

Appreciate any help or advice. TYIA.

 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @kressb 

Try this code.

Number3 Apr21 =
VAR _MaxDate =
    MAXX (
        FILTER ( ALL ( Table1 ), Table1[Location] = MAX ( Table1[Location] ) ),
        Table1[Date]
    )
RETURN
    CALCULATE (
        SUM ( Table1[Number3] ),
        FILTER (
            ALL ( Table1 ),
            AND ( Table1[Date] = _MaxDate, Table1[Location] = MAX ( Table1[Location] ) )
        )
    )

My Sample looks like below.

1.png

Result is as below.

1.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
v-rzhou-msft
Community Support
Community Support

Hi @kressb 

Try this code.

Number3 Apr21 =
VAR _MaxDate =
    MAXX (
        FILTER ( ALL ( Table1 ), Table1[Location] = MAX ( Table1[Location] ) ),
        Table1[Date]
    )
RETURN
    CALCULATE (
        SUM ( Table1[Number3] ),
        FILTER (
            ALL ( Table1 ),
            AND ( Table1[Date] = _MaxDate, Table1[Location] = MAX ( Table1[Location] ) )
        )
    )

My Sample looks like below.

1.png

Result is as below.

1.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

parry2k
Super User
Super User

@kressb not sure if I understood what you are trying to achieve. It will be easier if you share pbix file with the expected output and let's go from there. Remove sensitive information before sharing. You can share using onedrive/google drive



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Calculate(

                Sum (Table1[Number3]), 

                Filter( AllExcept (Table1,Table1[Location]), Table1[Date] = Max (Table1[Date]))
                )

@Anonymous Sorry, these don't work. same number for every location.

 

kressb
Helper V
Helper V

@amitchandak@Greg_Deckler  hm could you weigh in? a link or any small direction?

Anonymous
Not applicable

@kressb Try ALLEXCEPT(Table1,Table1[Location])

Calculate(

                Sum (Table1[Number3]), 

                AllExcept (Table1,Table1[Location]),

                Filter(Table1, Table1[Date] = Max (Table1[Date]))
                )

Result did not change, still no row context.

@parry2k any ideas?

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.