Forum Discussion
Anonymous
6 years agoNot applicable
SWITCH and ISFILTERED combination
Hi all
I am using a measure as follows:
Fixed cost var filters =
SWITCH(
TRUE(),
ISFILTERED(dDate[Year]),
DIVIDE(
CALCULATE(
SUM('Fixed Cost per Month'[fixed Cost]),
ALL('Fixed Cost per Month'[fixed Cost])
)
*MAX(dDate[Month Number]),
[Dedicated Shipments]
),
ISFILTERED(dDate[Month]),
DIVIDE(
SUM('Fixed Cost per Month'[fixed Cost]),
[Dedicated Shipments]
)
)
This when fed to visualization gives the below:
for only [Year] filtered
For [Months] filtered
What I actually want from the measure is to give the "Actual Required" column values which is [Sum fixed cost / Dedicated Shipment]
| Month | Dedicated Shipments | Sum fixed cost | Fixed cost var filters | Actual required |
| Jan | 1800 | 910000 | 505.56 | 505.56 |
| Feb | 3288 | 910000 | 553.53 | 276.76 |
| Mar | 3553 | 910000 | 768.36 | 256.12 |
| Apr | 3726 | 910000 | 976.92 | 244.23 |
| May | 4397 | 910000 | 1034.8 | 206.96 |
| Jun | 3965 | 910000 | 1377.05 | 229.51 |
| Jul | 3381 | 910000 | 1884.06 | 269.15 |
| Aug | 5502 | 910000 | 1323.16 | 165.39 |
| Sep | 6396 | 910000 | 1280.49 | 142.28 |
| Oct | 6602 | 910000 | 1378.37 | 137.84 |
| Nov | 7656 | 910000 | 1307.47 | 118.86 |
| Dec | 5928 | 910000 | 1842.11 | 153.51 |
Here,
Dedicated Shipments = CALCULATE([Shipments],'Prototype Modeling_Freight'[Transporter Type]="DEDICATED")
Please let me know if any additional info is required here for you to arrive to a conclusion.
All your comments and suggestions are greatly appreciated
- Anonymous6 years ago
Using INSCOPE instead of ISFILTER does the job
Fixed cost var filters = SWITCH( TRUE(), ISINSCOPE(dDate[Year]), DIVIDE( CALCULATE( SUM('Fixed Cost per Month'[fixed Cost]), ALL('Fixed Cost per Month'[fixed Cost]) ) *MAX(dDate[Month Number]), [Dedicated Shipments] ), ISINSCOPE(dDate[Month]), DIVIDE( SUM('Fixed Cost per Month'[fixed Cost]), [Dedicated Shipments] ), ISINSCOPE('Prototype Modeling_Freight'[Plant Cluster]), DIVIDE( SUM('Fixed Cost per Month'[fixed Cost]), [Dedicated Shipments] ), ISINSCOPE('Equipment Master'[Max Loadability in Tonns]), DIVIDE(VALUES('Fixed Cost per Month'[fixed Cost]),[Dedicated Shipments]),BLANK() )
1 Reply
- AnonymousNot applicable
Using INSCOPE instead of ISFILTER does the job
Fixed cost var filters = SWITCH( TRUE(), ISINSCOPE(dDate[Year]), DIVIDE( CALCULATE( SUM('Fixed Cost per Month'[fixed Cost]), ALL('Fixed Cost per Month'[fixed Cost]) ) *MAX(dDate[Month Number]), [Dedicated Shipments] ), ISINSCOPE(dDate[Month]), DIVIDE( SUM('Fixed Cost per Month'[fixed Cost]), [Dedicated Shipments] ), ISINSCOPE('Prototype Modeling_Freight'[Plant Cluster]), DIVIDE( SUM('Fixed Cost per Month'[fixed Cost]), [Dedicated Shipments] ), ISINSCOPE('Equipment Master'[Max Loadability in Tonns]), DIVIDE(VALUES('Fixed Cost per Month'[fixed Cost]),[Dedicated Shipments]),BLANK() )