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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
cbschley
Helper III
Helper III

Level of detail with specific logic conditions

Hello,


I am trying to perform a "level of detail" calculation.

 

In the example below, I want the "Modified_DC" field to display "MX05" for all rows, based on the Ship_From_DC where Master_Item = Material_ID.

I believe this can be done using eithe ALLSELECTED or ALLEXCEPT, but I haven't been able to figure this out. 

cbschley_0-1731085949242.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

Thanks for the solution parry2k offered, and i want to offer some more information for user to refer to.

hello @cbschley, you can create the following calculated column.

Modified_DC =
VAR a = [MASTER ITEM]
VAR b = [LOCATIONID]
RETURN
    CALCULATE (
        MAX ( 'Table'[SHIP_FROM_DC] ),
        FILTER ( 'Table', 'Table'[MASTERALID] = a && 'Table'[LOCATIONID] = b )
    )

Output

vxinruzhumsft_0-1731289551048.png

Best Regards!

Yolo Zhu

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

7 REPLIES 7
Anonymous
Not applicable

Hi,

Thanks for the solution parry2k offered, and i want to offer some more information for user to refer to.

hello @cbschley, you can create the following calculated column.

Modified_DC =
VAR a = [MASTER ITEM]
VAR b = [LOCATIONID]
RETURN
    CALCULATE (
        MAX ( 'Table'[SHIP_FROM_DC] ),
        FILTER ( 'Table', 'Table'[MASTERALID] = a && 'Table'[LOCATIONID] = b )
    )

Output

vxinruzhumsft_0-1731289551048.png

Best Regards!

Yolo Zhu

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

@cbschley yes, if you are planning to add it as a column, better to add at the source (always a best practice to bring data as upstream as possible, and as close to the source). That would be a proper solution.



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.

parry2k
Super User
Super User

@cbschley try this measure:

 

Modified_DC  = 
CALCULATE (
    MAX ( Table2[Ship_from_DC] ),
    FILTER (
        ALLSELECTED  ( Table2 ),
        Table2[Master_Item] = Table2[Material_Id] 
    ),
    VALUES ( Table2[Master_Item] )
)


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.

Hi @parry2k , I tried that, its now giving me a single value, but not the correct one. I would expect this to display "MX05" for that column:

cbschley_0-1731089063797.png

 

Are you adding this as a measure or a column? It is a measure.



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.

I am trying to add it as a column, because I need to create joins on this new column. Perhaps its best I just bring it up to the DB layer to avoid any issues.

Hi,

Share data in a format that can be pasted in an MS Excel file.  Show the expected result there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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