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

Sumx with filter on dynamic measure

Hi!

 

I have a table which shows me the volume in the number of shipping containers expected to be needed (forecast data).  The 'current shipping' field tells me the current strategy we are using to fill the container i.e. if we are completely filling the container (FCL = full container load) or if we will ship in Pallets. 

 

dapperscavenger_0-1702638709922.png

 

The 'recommended shipping' field is dynamically created using a parameter. The formula is: 

 

 

Rec Shipping = if([Fcst Cont] >= [FCL Value], "FCL", "Pallet QTY") 

 

 

The idea is that we put a limit ([FCL value] - a parameter) on the calculated no of containers we will need [FCST Cont] and if it exceeds that value then we must ship in FCL, not in pallets. The FCL value is a parameter that the user is able to adjust.

 

The calculation for the rec shipping is done on a row basis - based on a unique combination of the ship from location and the ship to country.

 

My team now wants me to be able to show a summary of the no. of containers in a table before and after the recommendations.  I can easily show the number of total containers forecasted to be needed, and the number we are currently shipping in full container loads:

 

dapperscavenger_1-1702639017278.png

 

but I do not know how to sum the no. of containers that would be needed if the rec shipping = "FCL"

I think I need to do a sumx of [Fcst cont] filtered where rec shipping = FCL.   [Fcst Cont] is just a switch to select how much forecast we are looking at:

 

 

 

Fcst Cont = SWITCH(TRUE(), 
VALUES(DimFcst[TimePeriod]) = "3mo Fcst", sum(FactData[3mo Cont]), 
VALUES(DimFcst[TimePeriod]) = "6mo Fcst", sum(FactData[6mo Cont]), 
VALUES(DimFcst[TimePeriod]) = "9mo Fcst", sum(FactData[9mo Cont]),
VALUES(DimFcst[TimePeriod]) = "12mo Fcst", sum(FactData[12mo Cont]), 
VALUES(DimFcst[TimePeriod]) = "15mo Fcst", sum(FactData[15mo Cont]), 
sum(FactData[18mo Cont]))

 

 

 

Any thoughts?

2 REPLIES 2
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Never mind, I am an idiot.  It was the easiest filter formula ever.  (which I thought I had tried earlier but honestly maybe I had one too many mince pies this christmas because my brain has turned into mince)

 

Fcst Cont Rec =
 CALCULATE([Fcst Cont], FILTER(FactData, [Rec Shipping] = "FCL"))

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.