Forum Discussion
Calculation Help
- 1 year ago
You can create measures like
Least Cost Shipment Count = VAR BaseTable = ADDCOLUMNS( VALUES( 'Ship History+Rates'[ShipmentID] ), "@least revenue carrier", CALCULATE( [Least Revenue Carrier], REMOVEFILTERS( 'Ship History+Rates'[SCAC/Rated] ) ) ) VAR Result = SELECTCOLUMNS( FILTER( GROUPBY( BaseTable, [@least revenue carrier], "@num", SUMX( CURRENTGROUP(), 1 ) ), [@least revenue carrier] = SELECTEDVALUE( 'Ship History+Rates'[SCAC/Rated] ) ), [@num] ) RETURN Resultand
Least Revenue Total = VAR BaseTable = ADDCOLUMNS( VALUES( 'Ship History+Rates'[ShipmentID] ), "@least revenue carrier", CALCULATE( [Least Revenue Carrier], REMOVEFILTERS( 'Ship History+Rates'[SCAC/Rated] ) ), "@least revenue value", CALCULATE( [Least Revenue$/Shipment], REMOVEFILTERS( 'Ship History+Rates'[SCAC/Rated] ) ) ) VAR Result = SELECTCOLUMNS( FILTER( GROUPBY( BaseTable, [@least revenue carrier], "@val", SUMX( CURRENTGROUP(), [@least revenue value] ) ), [@least revenue carrier] = SELECTEDVALUE( 'Ship History+Rates'[SCAC/Rated] ) ), [@val] ) RETURN ResultPut those into a table with 'Ship History+Rates'[SCAC/Rated] and it should work
https://drive.google.com/file/d/1aIHBTt5katrkMmOmEZg1vh8eEhhdk6hl/view?usp=drive_linkhttps://drive.google.com/file/d/1aIHBTt5katrkMmOmEZg1vh8eEhhdk6hl/view?usp=drive_link Hopefully this will work as still looking for assistance. Thank you.
Here is a different approach to your challenge. Instead of creating complex measures, i created a Fact table to specifically analyze the new carriers. Note that since its a fact table, it will only be refreshed when the semantic model refreshes.
- WorldWide11 year ago
Helper II
Thank you. I really love your approach.
However, doesn't quite do what we need. When all Carriers are Selected, it's good.
But the tables are not updating responding when we choose different carriers. For example, we still have the problem that when we remove Carriers from the Selection, the tables are not finding the next Least Cost Carrier on each ShipmentID and updating the results.
All Carriers Selected:
Now, with CTII removed from the Selection, it just removes CTII from the table, it doesn't update by finding the next Least Cost Carrier - we should still have 96 shipments after CTII is removed, but the Carrier counts and Least Revenue Totals should adjust according to the remaining Carriers:
I do appreciate any further assistance you have on this.
Thanks.
Brian.
- Tutu_in_YYC1 year ago
Super User
Thanks for the explanation. In this case, measures are the way to go. I will have a look.
- Tutu_in_YYC1 year ago
Super User
This looks promising. Have a look.
- WorldWide11 year ago
Helper II
Thank you - my company doesn't have the latest version of PBI yet apparently so I can't open your most recent workbook. can you save it in an earlier version? if not I'll get w/my IT people. Thank you.