Forum Discussion
Craterdee
1 year agoRegular Visitor
Help with data prep
Hi gang, I am attempting to "clean" my data so that I can get stats by truck, by proportionate share. 1. How can I get a list of orders by truck no. (so if an order has 3 trucks assigned to i...
- 1 year ago
You are indeed a super user!!! Thank you very much.
Now, I will actually go study the formulas 🙂
Very appreciated.
Chrsitine
MFelix
1 year agoSuper User
Hi Craterdee ,
I have made some changes using some auxiliary calculations add the following measures:
% Calculation =
var _CITY = 0.3
var _HWY = 0.7
var _TruckCount = CALCULATE(COUNTROWS(WO), WO[WO #] = SELECTEDVALUE(WO[WO #]), REMOVEFILTERS(MasterData[ID]))
var _Result = IF(SELECTEDVALUE(MasterData[Type]) = "City", DIVIDE(_CITY, _TruckCount), DIVIDE(_HWY, _TruckCount)
)
RETURN
_Result
% Calculation 1 Type =
var _CITY = 1
var _HWY = 1
var _TruckCount = CALCULATE(COUNTROWS(WO), WO[WO #] = SELECTEDVALUE(WO[WO #]), REMOVEFILTERS(MasterData[ID]))
var _Result = IF(SELECTEDVALUE(MasterData[Type]) = "City", DIVIDE(_CITY, _TruckCount), DIVIDE(_HWY, _TruckCount)
)
RETURN
_Result
Type Count =
var _TypeCount = CALCULATE( COUNTROWS( SUMMARIZE(WO, WO[WO #], MasterData[Type])), ALLSELECTED(MasterData[ID]))
RETURN
_TypeCount
Final Value % =
IF(
[Type Count] = 1 && [% Calculation] <> BLANK(),
SUMX(
SUMMARIZE(
WO,
WO[WO #],
MasterData[Type],
MasterData[ID]
),
[% Calculation 1 Type]
),
SUMX(
SUMMARIZE(
WO,
WO[WO #],
MasterData[Type],
MasterData[ID]
),
[% Calculation]
)
)
In the mockup I have made some changes in order to have a single type with 2 or more trucks in this case
add 3 rows 999999, 999998, 999997
Has you can see all the examples are there and believe they are properly calculated now just add the following measure for the total value:
Total Amount = SUM(WO[Amount])
Total Amount Value = IF(ISINSCOPE(MasterData[ID]), [Total Amount] * [Final Value %], DIVIDE([Total Amount], COUNTROWS(VALUES(WO[TruckID])
)))
See PBIX file attach.
Craterdee
1 year agoRegular Visitor
You are indeed a super user!!! Thank you very much.
Now, I will actually go study the formulas 🙂
Very appreciated.
Chrsitine