Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi All,
Need help for the below sample dataset. In excel we use the IF cond "=IF(A2=A1,0,1)"to retrive the Output.
Kindly let me know how can i get the same using DAX (Column) in Power BI.
Supplier Key : Dataset
Output required : Desired Output
| Suplier Key | Output required |
| 4D2B1234567 - Supplier - 1 | 1 |
| 4D2B1234567 - Supplier - 1 | 0 |
| 4D2B1234567 - Supplier - 1 | 0 |
| 4D2B1234567 - Supplier - 1 | 0 |
| 4D2B1234567 - Supplier - 1 | 0 |
| 4D2B1234567 - Supplier - 1 | 0 |
| 4D2B1234567 - Supplier - 1 | 0 |
| 4D2B1234567 - Supplier - 1 | 0 |
| 884B1234567 - Supplier - 1 | 1 |
| 884B1234567 - Supplier - 1 | 0 |
| 884B1234567 - Supplier - 1 | 0 |
| 4D2B1234567 - Supplier - 1 | 1 |
| 4D2B1234567 - Supplier - 1 | 0 |
| 4D2B1234567 - Supplier - 1 | 0 |
| 4D2B1234567 - Supplier - 1 | 0 |
| 4D2B1234567 - Supplier - 1 | 0 |
| 4D2B1234567 - Supplier - 2 | 1 |
| 4D2B1234567 - Supplier - 2 | 0 |
| T01B1234567 - Supplier - 3 | 1 |
| 661B1234567 - Supplier - 4 | 1 |
| 462B1234567 - Supplier - 5 | 1 |
| 477B1234567 - Supplier - 6 | 1 |
| 430B1234567 - Supplier - 7 | 1 |
| 477B1234567 - Supplier - 8 | 1 |
| 4A5B1234567 - Supplier - 9 | 1 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 4A5B1234567 - Supplier - 9 | 0 |
| 304B1234567 - Supplier - 10 | 1 |
| 4A5B1234567 - Supplier - 11 | 1 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| 4A5B1234567 - Supplier - 11 | 0 |
| T01B1234567 - Supplier - 12 | 1 |
| T01B1234567 - Supplier - 12 | 0 |
| T01B1234567 - Supplier - 12 | 0 |
| T01B1234567 - Supplier - 12 | 0 |
| T01B1234567 - Supplier - 12 | 0 |
| T01B1234567 - Supplier - 12 | 0 |
| 430B1234567 - Supplier - 13 | 1 |
| 430B1234567 - Supplier - 13 | 0 |
| T01B1234567 - Supplier - 14 | 1 |
| 468B1234567 - Supplier - 15 | 1 |
| 468B1234567 - Supplier - 15 | 0 |
| 468B1234567 - Supplier - 15 | 0 |
| 468B1234567 - Supplier - 15 | 0 |
| 468B1234567 - Supplier - 15 | 0 |
| 889B1234567 - Supplier - 16 | 1 |
| 889B1234567 - Supplier - 16 | 0 |
| 889B1234567 - Supplier - 16 | 0 |
| T01B1234567 - Supplier - 17 | 1 |
| 468B1234567 - Supplier - 18 | 1 |
| 304B1234567 - Supplier - 19 | 1 |
| 304B1234567 - Supplier - 19 | 0 |
| 614B1234567 - Supplier - 20 | 1 |
| 614B1234567 - Supplier - 20 | 0 |
| 614B1234567 - Supplier - 20 | 0 |
| 614B1234567 - Supplier - 20 | 0 |
| 614B1234567 - Supplier - 20 | 0 |
| 614B1234567 - Supplier - 20 | 0 |
| 430B1234567 - Supplier - 21 | 1 |
| 430B1234567 - Supplier - 21 | 0 |
| 468B1234567 - Supplier 1 | 1 |
| 4H8B1234567 - Supplier 2 | 1 |
| 4H8B1234567 - Supplier 2 | 0 |
| 606B1234567 - Supplier 3 | 1 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 606B1234567 - Supplier 3 | 0 |
| 468B1234567 - Supplier 4 | 1 |
| 456B1234567 - Supplier 5 | 1 |
| 468B1234567 - Supplier 6 | 1 |
| 525B1234567 - Supplier 7 | 1 |
| 468B1234567 - Supplier 8 | 1 |
| 468B1234567 - Supplier 8 | 0 |
| 468B1234567 - Supplier 8 | 0 |
| 468B1234567 - Supplier 8 | 0 |
| 468B1234567 - Supplier 8 | 0 |
| 456B1234567 - Supplier 9 | 1 |
| 472B1234567 - Supplier 10 | 1 |
| 472B1234567 - Supplier 10 | 0 |
| 472B1234567 - Supplier 10 | 0 |
| T01B1234567 - Supplier 11 | 1 |
| T01B1234567 - Supplier 11 | 0 |
| T01B1234567 - Supplier 11 | 0 |
| 456B1234567 - Supplier 12 | 1 |
| T01B1234567 - Supplier 13 | 1 |
| 4H8B1234567 - Supplier 14 | 1 |
| 4H8B1234567 - Supplier 14 | 0 |
| 4H8B1234567 - Supplier 14 | 0 |
| 4H8B1234567 - Supplier 14 | 0 |
| 4H8B1234567 - Supplier 14 | 0 |
| 4H8B1234567 - Supplier 14 | 0 |
Thanks
Allwin
Solved! Go to Solution.
@Anonymous add index column in your table in power query to find our previous row and then you can use that to calcuate the desired output
Match = VAR __prevRow = CALCULATE( MAX( 'Table'[Index] ) ) - 1 VAR __PrevRowValue = CALCULATE( MAX( 'Table'[Suplier Key] ), 'Table'[Index] = __prevRow ) VAR __currRowValue = CALCULATE( MAX( 'Table'[Suplier Key] ) ) RETURN IF( __currRowValue = __PrevRowValue, 0, 1 )
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 add index column in your table in power query to find our previous row and then you can use that to calcuate the desired output
Match = VAR __prevRow = CALCULATE( MAX( 'Table'[Index] ) ) - 1 VAR __PrevRowValue = CALCULATE( MAX( 'Table'[Suplier Key] ), 'Table'[Index] = __prevRow ) VAR __currRowValue = CALCULATE( MAX( 'Table'[Suplier Key] ) ) RETURN IF( __currRowValue = __PrevRowValue, 0, 1 )
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.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 40 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 25 |