The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
I have two set of data linked with the relationship seen here.
When trying to combine the tables I get either null value or $0.00 results back. I feel like this is an easy fix that I am just overlooking.
The measures are the following;
AvgValue2 = ([MinValue]+[MaxValue])/2
MinValue = VAR Min1 = CALCULATE( SUM('ns InventorySnapshot'[Value]), FILTER('ns InventorySnapshot', 'ns InventorySnapshot'[InventoryDate] = MIN(Dimtime[Date]) )) return IF(ISBLANK(Min1), 0, Min1)
MaxValue = VAR Max1 = CALCULATE( SUM('ns InventorySnapshot'[Value]), FILTER('ns InventorySnapshot', 'ns InventorySnapshot'[InventoryDate] = MAX(Dimtime[Date]) )) return IF(ISBLANK(max1), 0, Max1)
And the rest are columns of data. In the end I would like to divide the Extended cost by the average value.
Thanks,
Noel
Hello @NBOnecall
I believe you are getting blanks because the MIN(Dimtime[Date]) is outside your data range. If you don't have a time component selected it will pick the earliest date in your Dimtime table and calc against that. Try this
MinValue = VAR Min1 = CALCULATE( SUM('ns InventorySnapshot'[Value]), FILTER('ns InventorySnapshot', 'ns InventorySnapshot'[InventoryDate] = MIN('ns InventorySnapshot'[InventoryDate]) )) return IF(ISBLANK(Min1), 0, Min1)
MaxValue = VAR Max1 = CALCULATE( SUM('ns InventorySnapshot'[Value]), FILTER('ns InventorySnapshot', 'ns InventorySnapshot'[InventoryDate] = MAX('ns InventorySnapshot'[InventoryDate]) )) return IF(ISBLANK(max1), 0, Max1)
I don't think the date is the issue. See on this example when bringing in Extended Cost it is bringing in the total for all item for that day. For some reason the Item Internal ID isn't being associated correctly, but looking at the relationship it doesn't seem to be wrong?