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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

skip next row duplicate value in Power BI desktop

Hi,PBI_.JPG

I'm using SSAS tabular as source for the PBI report above. 

Sorted data on Measure value (CapacityWeightTonnes) descending, to get top N Route Codes.

1st row 'JFK-LHR' is going route, and 2nd row 'LHR-JFK' is return route for the same Airline.

Refer few return Route Codes like LHR-JFK and LHR-DFW (highlighted red above).

Can you please help me remove/hide those return Route Codes in PBI report itself?

1 ACCEPTED SOLUTION

@Anonymous 

 

Drag measure below to Visual level filters and set Show items when the value is 1.

Measure =
VAR c =
    LOOKUPVALUE (
        Table1[CapacityWeightTonnes],
        Table1[originAirport], MAX ( Table1[destinationAirport] ),
        Table1[destinationAirport], MAX ( Table1[originAirport] )
    )
RETURN
    IF (
        SUM ( Table1[CapacityWeightTonnes] ) > c
            || (
                SUM ( Table1[CapacityWeightTonnes] ) = c
                    && MAX ( Table1[originAirport] ) < MAX ( Table1[destinationAirport] )
            ),
        1
    )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
Anonymous
Not applicable

Hey @Anonymous

Try the following.

  • Go to edit queries.
  • Add a custom column
    Text.Start([RouteCode],3)
    2019-06-20 13_53_07-papercut - Remote Desktop Connection.png
  • Then remove duplicates based on that new column.

Good Luck! And let us know how it went.

 

Cheers!
A

Anonymous
Not applicable

Hi AClerk,

 

I'm using Live connection with SSAS Model, so won't able to add custom column as suggested in yoir post.

Can you please elaborate your approach in more detail, so I can see if it can be achieve slight different way

 

Thanks,

Anonymous
Not applicable

Hey,

As written above.

Not sure wats the logic behind your duplicates. But you might use the origin column?

Can you elaborate what is a duplicated record?
Cheers!
A

Anonymous
Not applicable

Hi,

 

Please look at 1st 2 rows in screen print (above original post), 

JFK-LHR

LHR-JFK 

If reposition Routes for 2nd row, it become equal to 1st row. And thats why wanted to skip the such occurances (like 2nd row)

Anonymous
Not applicable

Uh,

Got you now.

Forget about previous posts.

Sorry.

Anonymous
Not applicable

@Anonymous 

Please provide a sample that can be copied and pasted.

There should be a simple way to resolve this.

Thanks!
A

Anonymous
Not applicable

Hi,

 

Kindly find the sample data below,

 

RouteCodeCapacityWeightTonnesoriginAirportdestinationAirport
JFK-LHR11587.84JFKLHR
LHR-JFK11581.14LHRJFK
DFW-LHR11556.99DFWLHR
LHR-DFW11528.65LHRDFW
ORD-DFW9138.87ORDDFW
DFW-ORD9129.79DFWORD
ORD-LHR8135.65ORDLHR
LHR-ORD8100.96LHRORD
LAX-LHR6733.9LAXLHR
LHR-LAX6733.9LHRLAX
EZE-MIA6551.6EZEMIA
MIA-EZE6544.9MIAEZE
MIA-DFW6444.16MIADFW
DFW-MIA6406.29DFWMIA
GRU-MIA6324.63GRUMIA
MIA-GRU6310.46MIAGRU
NRT-DFW5298.4NRTDFW
DFW-NRT5249.46DFWNRT
PHL-LHR5065.55PHLLHR
LHR-PHL5037.49LHRPHL

 

Thanks,

@Anonymous 

 

Drag measure below to Visual level filters and set Show items when the value is 1.

Measure =
VAR c =
    LOOKUPVALUE (
        Table1[CapacityWeightTonnes],
        Table1[originAirport], MAX ( Table1[destinationAirport] ),
        Table1[destinationAirport], MAX ( Table1[originAirport] )
    )
RETURN
    IF (
        SUM ( Table1[CapacityWeightTonnes] ) > c
            || (
                SUM ( Table1[CapacityWeightTonnes] ) = c
                    && MAX ( Table1[originAirport] ) < MAX ( Table1[destinationAirport] )
            ),
        1
    )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks for the solution, but it works fine if don't have duplicate values either in Origin or Destination Airport.

It gives me error, while dealing with below sample data,

 

RouteCodeCapacityWeightTonnesoriginAirportdestinationAirport
JFK-LHR11587.84JFKLHR
LHR-JFK11581.14LHRJFK
DFW-LHR11556.99DFWLHR
LHR-DFW11528.65LHRDFW
ORD-DFW9138.87ORDDFW
DFW-ORD9129.79DFWORD
ORD-LHR8135.65ORDLHR
LHR-ORD8100.96LHRORD
LAX-LHR6733.9LAXLHR
LHR-LAX6733.9LHRLAX
EZE-MIA6551.6EZEMIA
MIA-EZE6544.9MIAEZE
MIA-DFW6444.16MIADFW
DFW-MIA6406.29DFWMIA
GRU-MIA6324.63GRUMIA
MIA-GRU6310.46MIAGRU
NRT-DFW5298.4NRTDFW
DFW-NRT5249.46DFWNRT
PHL-LHR5065.55PHLLHR
LHR-PHL5037.49LHRPHL
LHR-XXX11500LHRXXX
JFK-LHR11587.84JFKLHR
JFK-LHR100.84JFKLHR

 

For example we have "JFK-LHR" duplicate values here.

How to handle it?

Anonymous
Not applicable

I see you also have origin airport.

Can use that as well.

 

But!
How do you know which is duplicated?
I think there is a flaw in your logic.

 

Thanks!
A

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.