cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Resolver I

## Comparing Values listed in Table

Hi Everyone,

This is probably pretty straight forward but i am banging my head against the desk. I have a list of prices in a table and i want to be able to identify through using a slicer to select a particular date, what were the price changes that occured and what the old and new price is for the impacted widgets. I have mocked up some simple data to help work my problem.

 Vendor Item Price Start Date End Date Vendor A Widget 1 \$       4.00 1/1/2018 7/1/2018 Vendor A Widget 1 \$       4.10 7/1/2018 9/1/2018 Vendor A Widget 1 \$       4.12 9/1/2018 Vendor B Widget 2 \$       9.00 1/1/2018 Vendor C Widget 3 \$       6.00 1/1/2018 2/1/2018 Vendor C Widget 3 \$       9.00 2/1/2018 3/1/2018 Vendor C Widget 3 \$       1.00 3/1/2018 4/1/2018 Vendor C Widget 3 \$       6.00 4/1/2018 5/1/2018 Vendor C Widget 3 \$       3.00 5/1/2018 6/1/2018 Vendor C Widget 3 \$       3.00 6/1/2018 7/1/2018 Vendor C Widget 3 \$       4.00 7/1/2018 8/1/2018 Vendor C Widget 3 \$       9.00 8/1/2018 9/1/2018 Vendor C Widget 3 \$       3.00 9/1/2018 10/1/2018 Vendor C Widget 3 \$       4.00 10/1/2018 11/1/2018 Vendor C Widget 3 \$       1.00 11/1/2018 12/1/2018 Vendor C Widget 3 \$       5.00 12/1/2018 Vendor D Widget 4 \$       8.00 1/1/2018 7/1/2018 Vendor D Widget 4 \$       6.00 7/1/2018 1/1/2019

The solution would be in the image below where I select say "7/1/18" and it lists out the items that had price changes, and what the previous and new price is.

Thank you and let me know if you have any questions.

1 ACCEPTED SOLUTION
Solution Sage

Try adding this calculated column which returns the previous price and then add the column to your visual:

```MAXX(
CALCULATETABLE(
TOPN( 1, Data, Data[Start Date], DESC ),
ALLEXCEPT( Data, Data[Vendor], Data[Item] ),
Data[Start Date] < EARLIER( Data[Start Date] )
),
Data[ Price ]
)```

Proud to be a Datanaut!

3 REPLIES 3
Community Champion

@danb

You should use LOOKUPVALUE.

The lookup will be based on Vendor column and if the end date is different from start date then put the price

Solution Sage

Try adding this calculated column which returns the previous price and then add the column to your visual:

```MAXX(
CALCULATETABLE(
TOPN( 1, Data, Data[Start Date], DESC ),
ALLEXCEPT( Data, Data[Vendor], Data[Item] ),
Data[Start Date] < EARLIER( Data[Start Date] )
),
Data[ Price ]
)```

Proud to be a Datanaut!

Resolver I

@LivioLanzo - that worked great! Thank you very much and for your quick response!

Announcements

#### Fabric certifications survey

Certification feedback opportunity for the community.

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors