Forum Discussion
Showing latest date value with multiple conditions
Hi all,
I have the following set of data:
| Company | PO Date | Item# | Unit Price | IsNET | Supplier |
| 001 | 1/6/2021 | 110 | 1.23 | TRUE | ABC |
| 002 | 3/4/2021 | 111 | 1.45 | FALSE | BCD |
| 003 | 5/8/2021 | 112 | 1.56 | TRUE | CBE |
| 001 | 8/8/2021 | 111 | 1.3 | FALSE | DEF |
| 003 | 9/6/2021 | 112 | 1.89 | FALSE | CBE |
I need to create a matrix or table showing the Unit Price (which divided into CPG and NET) for the latest PO date in the following format:
| Item# | Supplier | |
| CPG Price | NET Price | |
CPG Price condition: IsNET = FALSE + Company <> 0001
NET Price condition: (IsNET = TRUE + Company <> 0001) + Company = 0001
Much appreciated for any help!!
- Anonymous4 years ago
Hi Helpful_Fun4848 ,
CPG = var _latest = CALCULATE(MAX('Table'[PO Date]),FILTER('Table','Table'[IsNET]="FALSE"&&'Table'[Company]<>"0001")) return CALCULATE(SUM('Table'[Unit Price]),FILTER('Table','Table'[PO Date]=_latest))NET = var _latest = CALCULATE(MAX('Table'[PO Date]),FILTER('Table',('Table'[IsNET]="TRUE"&&'Table'[Company]<>"0001")||'Table'[Company]="0001")) return CALCULATE(SUM('Table'[Unit Price]),FILTER('Table','Table'[PO Date]=_latest))Best Regards,
Jay
7 Replies
- lbendlin
Super User
"NET Price condition: (IsNET = TRUE + Company <> 0001) + Company = 0001"
This will always evaluate to false. Please check the definition.
- Helpful_Fun4848
Helper III
The statement on my OP may not be correct. The 2 conditions for NET Price:
1. IsNET = TRUE
2. Everything from Company 0001 including if IsNET = FALSE
- lbendlin
Super User
CPG = 'Table'[IsNET]=FALSE() && 'Table'[Company]<>"001" NET = 'Table'[IsNET]=TRUE() || 'Table'[Company] = "001"These are calculated columns - no need for measures. Note that they are complementary, so you could also say
NET = NOT CPG
- AnonymousNot applicable
Hi Helpful_Fun4848 ,
CPG = var _latest = CALCULATE(MAX('Table'[PO Date]),FILTER('Table','Table'[IsNET]="FALSE"&&'Table'[Company]<>"0001")) return CALCULATE(SUM('Table'[Unit Price]),FILTER('Table','Table'[PO Date]=_latest))NET = var _latest = CALCULATE(MAX('Table'[PO Date]),FILTER('Table',('Table'[IsNET]="TRUE"&&'Table'[Company]<>"0001")||'Table'[Company]="0001")) return CALCULATE(SUM('Table'[Unit Price]),FILTER('Table','Table'[PO Date]=_latest))Best Regards,
Jay