Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Parthsh93
Helper IV
Helper IV

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

31.PNG

For [Months] filtered
30.PNG
What I actually want from the measure is to give the "Actual Required" column values which is [Sum fixed cost / Dedicated Shipment]

MonthDedicated ShipmentsSum fixed costFixed cost var filtersActual required
Jan1800910000505.56505.56
Feb3288910000553.53276.76
Mar3553910000768.36256.12
Apr3726910000976.92244.23
May43979100001034.8206.96
Jun39659100001377.05229.51
Jul33819100001884.06269.15
Aug55029100001323.16165.39
Sep63969100001280.49142.28
Oct66029100001378.37137.84
Nov76569100001307.47118.86
Dec59289100001842.11153.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

1 ACCEPTED SOLUTION
Parthsh93
Helper IV
Helper IV

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()
    )

View solution in original post

1 REPLY 1
Parthsh93
Helper IV
Helper IV

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()
    )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors