Forum Discussion
Can we have this Dynamic instead of Hard code
- 7 years ago
Hi Anonymous
Not so clear about your criteria.
I make a test but get a different result.
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
MaggieCommunity 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 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
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.
https://www.dropbox.com/s/136eqpr04igfuqt/Sample%20data%201.xlsx?dl=0
Appreaciate your help!
Thanks,
Tejaswi
- v-juanli-msft7 years ago
Community Support
Hi Anonymous
Not so clear about your criteria.
I make a test but get a different result.
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
MaggieCommunity 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.- Anonymous7 years agoNot applicable