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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Can we have this Dynamic instead of Hard code

Hi,

 

I have this code which is hard coded. I want to have it dynamic using DAX measure. 

 

Can this be done ?

 

Base UOM Highlights = Maxx( material,
IF(Material[Material group]="CORSF" || Material[Material group]="LBLTHT",
  IF(Material[Material type]="ZHWA",
      IF (Material[Base Unit of Measure]<>"EA" && Material[Base Unit of Measure]<>"ROL",1,2)),
IF(Material[Material group]="LBLTHT", IF(Material[Material type]="ZNBW", IF (Material[Base Unit of Measure]<>"EA" ,1,2))

Thanks in Advance!

 

Thanks,

Tejaswi

1 ACCEPTED SOLUTION

Hi @Anonymous 

Not so clear about your criteria.

I make a test but get a different result.

1.png

Measure =
IF (
    (
        MAX ( Table1[Material group] ) IN { "CORSF", "LBLTHT" }
            && MAX ( Table1[Material type] ) = "ZHWA"
            && MAX ( Table1[Base UOM] ) = "EA"
    )                                              # your condition1 & 2
        || (
            MAX ( Table1[Material group] ) = "PKGCON"
                && MAX ( Table1[Material type] ) = "ZHWA"
                && MAX ( Table1[Base UOM] ) IN { "EA", "KIT", "SET", "KIT", "CV", "PK", "CAN" }
        ),                                            # your condition3
    2,
    1
)

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
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

5 REPLIES 5
parry2k
Super User
Super User

@Anonymous what part you want dyamic? You have to provide the logic what you are looking for?

 

Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



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

@parry2k ,

 

Hi,

 

Wondering if you had a chance to go thru this.

Please let me know for any questions.

 

Thanks,

Tejaswi

Anonymous
Not applicable

Hi @parry2k ,

Thanks for your reply!

 

I want to use a list or array in my code. 

 

I have these below conditions:

-If Material Group is CORSF and Material Type is ZHWA then Base UOM should always be EA. ( if other than EA return me 1 else 2 )

If material Group is CORSF or LBLTHT and material type is ZHWA then Base UOM should always be EA.( if other than EA return me 1 else 2 )

- If Material Group is PKGCON, and material Type is ZHWA, then base uom can be either EA, KIT,SET,KIT,CV,PK or CAN (if other than these return me 1 else 2)

 

Here is the same sample data file in the dropbox link for your reference.

 

Capture 33.PNG

 

https://www.dropbox.com/s/136eqpr04igfuqt/Sample%20data%201.xlsx?dl=0

 

 

 

Appreaciate your help!

Thanks,

Tejaswi

 

 

 

 

Hi @Anonymous 

Not so clear about your criteria.

I make a test but get a different result.

1.png

Measure =
IF (
    (
        MAX ( Table1[Material group] ) IN { "CORSF", "LBLTHT" }
            && MAX ( Table1[Material type] ) = "ZHWA"
            && MAX ( Table1[Base UOM] ) = "EA"
    )                                              # your condition1 & 2
        || (
            MAX ( Table1[Material group] ) = "PKGCON"
                && MAX ( Table1[Material type] ) = "ZHWA"
                && MAX ( Table1[Base UOM] ) IN { "EA", "KIT", "SET", "KIT", "CV", "PK", "CAN" }
        ),                                            # your condition3
    2,
    1
)

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @v-juanli-msft ,

 

This just worked as expected.

 

Many thnaks for the solutions!

 

Regardfs,

Tejaswi

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors