# View: product_physical_change_history_mgm

**View Name:** product_physical_change_history_mgm
**Table Source:** `Derived from: Art_Relations_Prod_Art_Relations.Product_Physical_Change_History, Orchard_App_Reporting_V2, Orchard_App_Reporting_V2.Art_Relations_Prod_Art_Relations`
**File Path:** `product_physical_change_history_mgm.view.lkml`

## Overview

- **File Size:** 3308 bytes
- **Lines of Code:** 138
- **Dimensions:** 13
- **Measures:** 1
- **Dimension Groups:** 5
- **Filters:** 0

## Comments & Notes

- select ppp.*
- from orchard_app_reporting_v2.art_relations_prod_art_relations.product_physical_change_history ppp
- select p.product_id, p.field_name, max(p.date_changed) as last_date

## Dimensions

| Name | Type |
|------|------|
| `id` | number |
| `rank` | number |
| `delivered` | string |
| `field_name` | string |
| `new_deletion_status` | string |
| `new_price` | string |
| `new_price_last_entry` | number |
| `old_deletion_status` | string |
| `artworkpath` | string |
| `old_price` | number |
| `product_id` | number |
| `store_id` | number |
| `store_name` | string |

## Measures

| Name | Type |
|------|------|
| `count` | count |

## Dimension Groups

| Name | Type |
|------|------|
| `date_changed` | time |
| `new_sale_start` | time |
| `old_sale_start` | time |
| `old_embargo_start` | time |
| `new_embargo_start` | time |

## Derived Table

```sql
sql:
            select *,
            rank() over (partition by product_id, field_name, store_id order by date_changed desc) as rank,
            last_value (new_price) over (partition by product_id, store_id order by date_changed) as new_price_last_entry
            from orchard_app_reporting_v2.art_relations_prod_art_relations.product_physical_change_history
            where store_id = 737 or store_id is null ;;
```

