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
Anonymous
Not applicable

double filter for same dimension

Hi all,

 

I know the subject looks weird. 

 

First of all i don't know is it possible or not.
It might be difficult for me to write that. I'm using images to tell.

Screenshot_9.png

I need to create 2 measure it affected by 2 material dimension filter. Then according to combinations of the choice, it should be return proper value.
Here is the some example about combinations.

Screenshot_9.pngScreenshot_10.pngScreenshot_12.pngScreenshot_13.png

Here is the example PBIX file.
Waiting for your helps..
Regards

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

@Anonymous solution attached.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



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.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @Anonymous, @parry2k@hohlick 

All of yours solutions are work fine. Thank you for your helps. 
I marked 2 solution because their working logic is different.
I continued with @Anonymous solution.
I want to ask one more thing in there.
Is it possible to add one more case to Type parameter as "Exclude". It means it must include first material but it should not include second material.

Anonymous
Not applicable

Exclusion should also be possible. You have to add another value for "exclude" in the table where you have given "and" and "or" is listed.

 

Then accordingly, based on the value of exclusion, add one more IF condition or SWITCH to change the measures accordingly.

 

Nothing complicated. Writing down the logic/algorithim on paper first and then transferring them to DAX code will help if you have any confusion. Sometimes, our brains are good with pen and paper than on computer when working with logics.😀

First of all, you need to create two disconnected dimensions for Material:

Slicer1 = DISTINCT(Invoice[Material])

and

Slicer2 = Slicer1

Then make inactive relationships to you Invoice table:

 

Inactive relationshipsInactive relationships

 

Then your measure Cost-1 will be:

Cost-1 =
IF (
    [Type Value] = 2,
    CALCULATE (
        SUM ( Invoice[Cost] ),
        USERELATIONSHIP ( Invoice[Material], Slicer1[Material] )
    ),
    CALCULATE (
        SUM ( Invoice[Cost] ),
        USERELATIONSHIP ( Invoice[Material], Slicer1[Material] ),
        CALCULATETABLE (
            VALUES ( Invoice[Invoice] ),
            USERELATIONSHIP ( Invoice[Material], Slicer2[Material] )
        )
    )
)

and another almost the similar:

Cost-2 =
IF (
    [Type Value] = 2,
    CALCULATE (
        SUM ( Invoice[Cost] ),
        USERELATIONSHIP ( Invoice[Material], Slicer2[Material] )
    ),
    CALCULATE (
        SUM ( Invoice[Cost] ),
        USERELATIONSHIP ( Invoice[Material], Slicer2[Material] ),
        CALCULATETABLE (
            VALUES ( Invoice[Invoice] ),
            USERELATIONSHIP ( Invoice[Material], Slicer1[Material] )
        )
    )
)

as you can see, they differ only for relationships selected.

 

Maxim Zelensky
excel-inside.pro
Anonymous
Not applicable

@Anonymous solution attached.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



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

Hi @parry2k , How did you attach the file. Somehow I am unable to find the attach file option and I had to host it on onedrive and share the link. Can you tell me how to attach files here? 

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.