The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi Everybody,
I want to add the yellow line mark amount. How to do it in dax. Is there anyone to help me.
Question: How can i write dax for same version no for max line no.
Solved! Go to Solution.
Hi @Anonymous ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) Click "Transform Data", enter the power query editor, click "Advanced Editor", copy and paste the following code, you can check the steps in the right step bar.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fc9BCsQgDAXQu2Tdhvi/2vQGs5pVd8X7X2PswtKRqiAYeH7yz1OOz1cWOVZwNTNYHcJ17Tr14USSsgwhGqw/dqjnGWbDiPum09x40xCihhlNjW6g0t+o97XAnBWvsd43A0cbeN8rJYNyaPG3QnQqOLN45FIDpJQf", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Salesperson Code" = _t, #"Document No_" = _t, #"Version No_" = _t, #"Line No_" = _t, #"Line Amount" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Salesperson Code", type text}, {"Document No_", type text}, {"Version No_", Int64.Type}, {"Line No_", Int64.Type}, {"Line Amount", type number}}),
#"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Document No_", "Document No_ - Copy"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Duplicated Column", "Document No_", Splitter.SplitTextByDelimiter("-", QuoteStyle.Csv), {"Document No_.1", "Document No_.2", "Document No_.3"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Document No_.1", type text}, {"Document No_.2", Int64.Type}, {"Document No_.3", Int64.Type}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Document No_ - Copy", "Document No_"}}),
#"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "Index", 1, 1, Int64.Type)
in
#"Added Index"
(3)Click "Apply and close" and then we can create two measures.
Measure =
var _a= CALCULATE(MAX('Table'[Line No_]),FILTER(ALLEXCEPT('Table','Table'[Salesperson Code],'Table'[Document No_.3],'Table'[Version No_]),'Table'[Line No_]))
var _b= CALCULATE(MAX('Table'[Line Amount]),FILTER(ALLEXCEPT('Table','Table'[Salesperson Code],'Table'[Document No_.3],'Table'[Version No_]),'Table'[Line No_]=_a))
return _b
color = IF(MAX('Table'[Line Amount])='Table'[Measure],1,0)
(4) Set the conditional formatting as shown in the following figure and then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) Click "Transform Data", enter the power query editor, click "Advanced Editor", copy and paste the following code, you can check the steps in the right step bar.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fc9BCsQgDAXQu2Tdhvi/2vQGs5pVd8X7X2PswtKRqiAYeH7yz1OOz1cWOVZwNTNYHcJ17Tr14USSsgwhGqw/dqjnGWbDiPum09x40xCihhlNjW6g0t+o97XAnBWvsd43A0cbeN8rJYNyaPG3QnQqOLN45FIDpJQf", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Salesperson Code" = _t, #"Document No_" = _t, #"Version No_" = _t, #"Line No_" = _t, #"Line Amount" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Salesperson Code", type text}, {"Document No_", type text}, {"Version No_", Int64.Type}, {"Line No_", Int64.Type}, {"Line Amount", type number}}),
#"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Document No_", "Document No_ - Copy"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Duplicated Column", "Document No_", Splitter.SplitTextByDelimiter("-", QuoteStyle.Csv), {"Document No_.1", "Document No_.2", "Document No_.3"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Document No_.1", type text}, {"Document No_.2", Int64.Type}, {"Document No_.3", Int64.Type}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Document No_ - Copy", "Document No_"}}),
#"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "Index", 1, 1, Int64.Type)
in
#"Added Index"
(3)Click "Apply and close" and then we can create two measures.
Measure =
var _a= CALCULATE(MAX('Table'[Line No_]),FILTER(ALLEXCEPT('Table','Table'[Salesperson Code],'Table'[Document No_.3],'Table'[Version No_]),'Table'[Line No_]))
var _b= CALCULATE(MAX('Table'[Line Amount]),FILTER(ALLEXCEPT('Table','Table'[Salesperson Code],'Table'[Document No_.3],'Table'[Version No_]),'Table'[Line No_]=_a))
return _b
color = IF(MAX('Table'[Line Amount])='Table'[Measure],1,0)
(4) Set the conditional formatting as shown in the following figure and then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.