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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Compare positive and negative numbers in rows.

Hello,

I am not sure,How to compare rows in power bi? Query Editor or Dax ?

Loigc:

Step 1:Need to find Negative Count, Negative Avg and Negative Curr

No

Flag

Count

Avg

Curr

111

N

1

200

600

 

Step 2:Need to find Positive Count, Positive Avg and Positive Curr

No

Flag

Count

Avg

Curr

111.1

Y

-1

-200

-600

 

Expection:Count positive and negative number should be same, Avg positive and negative number should be same,Curr positive and negative number should be same then in a new column mark it as A and if condtion does not match then mark it as B (In other word when Avg and Curr are unique then mark it as B).

Dataset

Raw Data

 

No

Flag

Count

Avg

Curr

 

111

N

1

200

600

 

222

N

1

300

700

 

333

N

1

400

800

 

111.1

Y

-1

-200

-600

 

555.1

N

1

500

900

 
      

Result

No

Flag

Count

Avg

Curr

Check

111

N

1

200

600

A

222

N

1

300

700

B

333

N

1

400

800

B

111.1

Y

-1

-200

-600

A

555.1

N

1

500

900

B

3 REPLIES 3
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

Please new a calculated table in raw data table.

Check =
IF (
    LOOKUPVALUE (
        'Raw Data'[No],
        'Raw Data'[Count], 'Raw Data'[Count] * -1,
        'Raw Data'[Avg], 'Raw Data'[Avg] * -1,
        'Raw Data'[Curr], 'Raw Data'[Curr] * -1
    )
        <> BLANK (),
    "A",
    "B"
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Yuliana,

Thank you so much for your help.

When I have used below forumula it gave me below error.Due to duplicate dataset i get an error this is what i figure it out  but i am not sure how to fix below error?

Is there any suggestion ?yuliana.png

Hi @Anonymous,

 

Please refer to my reply in an other post.

A table of multiple values was supplied where a single value was expected

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.