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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
SCHOOF_MM
Frequent Visitor

Sum by column filter by date then show by TOPN

Hello, I cannot get my sum to filter with my date slicer. 

My end goal is to show the top 5 percent scrap by dividing the sum of scrap by material and the sum of yield + scrap by material while ignoring the outliers of scrap.

The table on the left accurately shows the data through measures that filters by the slicer at the bottom and shows less than 100%, greater than 0% to remove the outliers. The issue here is I cannot use TOPN on a measure. 

The table on the right shows the same data through calculated columns showing less than 100%, greater than 0%. This table I can use TOPN but it will not sum correctly with the slicer. 

You can see between the two pictures below that they do not represent the same percentage per material when you change the week of the year. 

SCHOOF_MM_0-1667590092890.png

SCHOOF_MM_1-1667590113874.png

My formulas for the columns are below: 

Total Scrap = CALCULATE(SUM(SAPCrosstab1[ Actual Scrap [Quantity]]]),ALLEXCEPT(SAPCrosstab1,SAPCrosstab1[Material]))

 

TotalYieldScrap=CALCULATE(SUM(SAPCrosstab1[ActualYield+Scrap[Quantity]]]),ALLEXCEPT(SAPCrosstab1,SAPCrosstab1[Material]))

 

Total Scrap % = DIVIDE(SAPCrosstab1[Total Scrap],SAPCrosstab1[Total YieldScrap])

 

I tried to include a filter by date but when I did that, it calculated by date and ignored the group by material. I am sure I just haven’t found the correct DAX formula. Does anyone have any ideas? 

 

I am not too sure how to attach the file here so I will insert more photos. Please let me know if you need more information. The data table can be ignored for now unless its my relationship that is messing up the calulation. Each calendar day(date) goes to the Calendar table Date. Each Material goes to the Material table Material. I am using the WeekNum in the Calendar table as my slicer. 

 

SCHOOF_MM_2-1667590315042.png

SCHOOF_MM_3-1667590336608.png

SCHOOF_MM_5-1667590401292.png

SCHOOF_MM_6-1667590450358.png

 

2 REPLIES 2
mangaus1111
Solution Sage
Solution Sage

Hi @SCHOOF_MM ,

using ALLEXCEPT(SAPCrosstab1,SAPCrosstab1[Material]), you remove all the filters except the filter of the Material column. Your slicer does not work why you have removed even the filter from the calendar table.

 

Tra to use ALLSELECTED('Calendar') next to ALLEXCEPT in order to restore the filter on the Calendar Table.

For example:

Total Scrap = CALCULATE(SUM(SAPCrosstab1[ Actual Scrap [Quantity]]]),ALLEXCEPT(SAPCrosstab1,SAPCrosstab1[Material]), ALLSELECTED('Calendar'))

 

TotalYieldScrap=CALCULATE(SUM(SAPCrosstab1[ActualYield+Scrap[Quantity]]]),ALLEXCEPT(SAPCrosstab1,SAPCrosstab1[Material]),ALLSELECTED('Calendar'))

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hey! Thank you for the response. 

I tried what you mentioned and it didn't work. I tried it in the SAPCrosstab1 table and I even added it the Material Table (as shown below in photo) thinking that might work if it wasnt in the same table. I also tried using the Calendar Date in the SAPCrosstab1 table instead of the Calendar table thinking it might be the relationship but that did not work either. 

 

Do you know if there is a way I could show just the top scrap values using the measure after talking out the outliers that might work instead of trying to get the columns to filter and sum by date? 

 

Here are also the formulas for when I tried to move it into the Material table. 

Actual YieldScrap =
SUMX (
    FILTER ( 'SAPCrosstab1', 'SAPCrosstab1'[Material] = 'Material'[Material]),
   CALCULATE(SUM('SAPCrosstab1'[    Actual Yield + Scrap   [Quantity]]]), ALLSELECTED(SAPCrosstab1[Calendar Day])))
 
Actual Scrap =
SUMX (
    FILTER ( 'SAPCrosstab1', 'SAPCrosstab1'[Material] = 'Material'[Material]),
   CALCULATE(SUM('SAPCrosstab1'[  Actual  Scrap [Quantity]]]), ALLSELECTED(SAPCrosstab1[Calendar Day])))
 
SCHOOF_MM_0-1667833309415.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.