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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
v-xinruzhu-msft
Community Support
Community Support

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
v-xinruzhu-msft
Community Support
Community Support

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.