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.
Hi All,
I'm trying to create a column that returns the earliest day when lowest and highest cost happened. I have a table with header "sku_id","cost","order_date", and I have tried the formula "Min[order_date] if [cost] is max" ; but the formula didn't ran through.
Solved! Go to Solution.
hI @Anonymous
Assuming that this is on a per sku level, try these:
Earliest Date - Lowest Cost =
VAR __LOWEST_COST =
CALCULATE ( MIN ( 'Table'[cost ] ), ALLEXCEPT ( 'Table', 'Table'[sku] ) )
RETURN
CALCULATE (
MIN ( 'Table'[order date] ),
ALLEXCEPT ( 'Table', 'Table'[sku] ),
'Table'[cost ] = __LOWEST_COST
)
Eearliest Date - Highest Cost =
VAR __HIGHEST_COST =
CALCULATE ( MAX( 'Table'[cost ] ), ALLEXCEPT ( 'Table', 'Table'[sku] ) )
RETURN
CALCULATE (
MIN( 'Table'[order date] ),
ALLEXCEPT ( 'Table', 'Table'[sku] ),
'Table'[cost ] = __HIGHEST_COST
)
Proud to be a Super User!
hI @Anonymous
Assuming that this is on a per sku level, try these:
Earliest Date - Lowest Cost =
VAR __LOWEST_COST =
CALCULATE ( MIN ( 'Table'[cost ] ), ALLEXCEPT ( 'Table', 'Table'[sku] ) )
RETURN
CALCULATE (
MIN ( 'Table'[order date] ),
ALLEXCEPT ( 'Table', 'Table'[sku] ),
'Table'[cost ] = __LOWEST_COST
)
Eearliest Date - Highest Cost =
VAR __HIGHEST_COST =
CALCULATE ( MAX( 'Table'[cost ] ), ALLEXCEPT ( 'Table', 'Table'[sku] ) )
RETURN
CALCULATE (
MIN( 'Table'[order date] ),
ALLEXCEPT ( 'Table', 'Table'[sku] ),
'Table'[cost ] = __HIGHEST_COST
)
Proud to be a Super User!
@Anonymous , Try like these .
Date for max= calculate(lastnonblankvalue([cost], max([order_date])),filter(table,[sku_id] =earlier(sku_id)))
date for min = calculate(firstnonblankvalue([cost], max([order_date])),filter(table,[sku_id] =earlier(sku_id)))
if not
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |