Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi @SachinC ,
your specifications is a bit short when it comes to what your desired outcome is. Here is the code for creating a calculated column:
PercentageReturns =
VAR _route =
CALCULATE ( SELECTEDVALUE ( 'Table'[Route] ) )
VAR _drops =
CALCULATE (
SUM ( 'Table'[TotalDrops] );
FILTER ( ALL ( 'Table' ); 'Table'[Route] = _route )
)
VAR _returns =
CALCULATE (
SUM ( 'Table'[Returns] );
FILTER ( ALL ( 'Table' ); 'Table'[Route] = _route )
)
RETURN
DIVIDE ( _returns; _drops )
keep in mind that when you aggregate like this in a calculated column, the value is repeated for each route, and if you later on sum over this column, it will be wrong.
For some reason that didn't work. Bear in mind Returns is a Count not Sum.
is there a ";" missing? It's suggesting it is.
Thanks!
| User | Count |
|---|---|
| 59 | |
| 47 | |
| 31 | |
| 18 | |
| 17 |
| User | Count |
|---|---|
| 77 | |
| 66 | |
| 46 | |
| 22 | |
| 22 |