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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Antmkjr
Post Patron
Post Patron

How to implement the below dax in power query

I am fairly new to power query,
 
The below logic is of a calculated column, how to implement the same in power query:
 
Flag =
IF (
'Discoverer- AP Payment 1 - Summary'[Difference] = 0,
"Matched",
IF (
AND (
OR (
'Discoverer- AP Payment 1 - Summary'[Discoverer Amount] = BLANK (),
ROUND ( 'Discoverer- AP Payment 1 - Summary'[Discoverer Amount], 0 ) = 0
),
'Discoverer- AP Payment 1 - Summary'[Difference] <> 0
),
"Ignore",
IF (
AND (
'Discoverer- AP Payment 1 - Summary'[AP Amount] = 0,
ROUND ( 'Discoverer- AP Payment 1 - Summary'[Discoverer Amount], 0 ) <> 0
),
"Void/Unmatched",
"Unmatched"
)
)
)
1 ACCEPTED SOLUTION
ERD
Community Champion
Community Champion

Hi @Antmkjr ,

What error do you get? Make sure you choose correct types for your columns (Decimal numbers for DA,Difference,AP).

if [Difference] = 0 
then "Matched"
else if ([DA]=null or Number.Round([DA],0) = 0) and [Difference] <> 0 
then "Ignore" 
else if [#"AP "] = 0 and Number.Round([DA],0) <> 0 
then "Void/Unmatched" 
else "Unmatched"

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

6 REPLIES 6
StefanoGrimaldi
Resident Rockstar
Resident Rockstar

SOMETHING LIKE THIS (REMEBER YOU NEED TO BREAK DOWN THE MEASURE HERE FOR IT TO WORK ALSO): 

IF

(Discoverer- AP Payment 1 - Summary'[Difference]) = 0 then

"Matched",

Else IF

 

('Discoverer- AP Payment 1 - Summary'[Discoverer Amount] = null OR

Number.ROUND( 'Discoverer- AP Payment 1 - Summary'[Discoverer Amount], 0 ) = 0) AND

'Discoverer- AP Payment 1 - Summary'[Difference] <> 0

 

Then

"Ignore",

Else IF 

('Discoverer- AP Payment 1 - Summary'[AP Amount] = 0 AND

NUMBER.ROUND ( 'Discoverer- AP Payment 1 - Summary'[Discoverer Amount], 0 ) <> 0) THEN

"Void/Unmatched" ELSE "Unmatched"





Did I answer your question? Mark my post as a solution! / Did it help? Give some Kudos!

Proud to be a Super User!




I have tried this but getting error, not able to understand what is wrong:

 

if

[Difference] = 0 then

"Matched"

else if

[Discoverer Amount] = null OR

Number.ROUND( [Discoverer Amount], 0 ) = 0) AND

[Difference] <> 0

Then

"Ignore",

Else IF

([AP Amount] = 0 AND

NUMBER.ROUND ( [Discoverer Amount], 0 ) <> 0) THEN

"Void/Unmatched" ELSE "Unmatched"

try this: 

if

[Difference] = 0 then

"Matched"

else if

([Discoverer Amount] = null) OR

(Number.ROUND( [Discoverer Amount], 0 ) = 0 AND

[Difference] <> 0)

Then

"Ignore",

Else IF

([AP Amount] = 0 AND

NUMBER.ROUND ( [Discoverer Amount], 0 )) <> 0 THEN

"Void/Unmatched" ELSE "Unmatched"

 

if doesnt work send a sample data or a sample PBIX to fix it and give the exact Mquery formula.





Did I answer your question? Mark my post as a solution! / Did it help? Give some Kudos!

Proud to be a Super User!




ERD
Community Champion
Community Champion

Hi @Antmkjr ,

What error do you get? Make sure you choose correct types for your columns (Decimal numbers for DA,Difference,AP).

if [Difference] = 0 
then "Matched"
else if ([DA]=null or Number.Round([DA],0) = 0) and [Difference] <> 0 
then "Ignore" 
else if [#"AP "] = 0 and Number.Round([DA],0) <> 0 
then "Void/Unmatched" 
else "Unmatched"

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

StefanoGrimaldi
Resident Rockstar
Resident Rockstar

first I see you have measure inside that dax, Power Query doesnt use measure you need to break those down to it logical code, its pretty much the same except for the functions name but basically copy that code, delete all parentesis and comas for the ifs, the logic of if its as follow 

 

if Column 1 > column 2 and column 2 > 3   then 1 else 2    --> if you want to imput text its the same use "1" intead of number 1 it will insert the value as a text for thta column. you cant mix datatype on the results. 

equivalent of blank() --> null 

round its --> number.round





Did I answer your question? Mark my post as a solution! / Did it help? Give some Kudos!

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors