Forum Discussion
How to create mapping for GL CODE ?
- Anonymous5 years ago
Hi Anonymous
I think you want to build a new column to create mapping for GL CODE column.
I build a table Like yours and have a test.
Dax:
Switch or IF function.
Dax_Recode = SWITCH(TRUE(),MAX('Table'[GL_CODE])<=9,"REVENUE",MAX('Table'[GL_CODE])<=19,"COGS",BLANK())Power Query Editor :
Use Add Conditional Column Function, you can copy my M Query in your advanced Editor.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTI0ABJBrmGufqGuCj7+zo4+SrE60UpGQFEjZCn/MNegYFdHBbCsJbpGT78Q1yAFZ/9IsDRYyhSInf3dg5EMNQTpM4OJQ01Uio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [GL_CODE = _t, Amount = _t, #"DESCRIPTION " = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"GL_CODE", Int64.Type}, {"Amount", Int64.Type}, {"DESCRIPTION ", type text}}), #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Recode", each if [GL_CODE] <= 9 then "REVENUE" else if [GL_CODE] <= 19 then "COGS" else null) in #"Added Conditional Column"Result:
You can download the pbix file from this link: How to create mapping for GL CODE ?
If this reply still couldn't help you solve your problem, please show me the result you want, and your data model. This will make it easier for me to understand your requirement.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
You can download the pbix file from this link: How to create mapping for GL CODE ?
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Sir
Thank you very much
Paul
- Anonymous5 years agoNot applicable
Hi Anonymous
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Rico Zhou