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
PowerKoen
Frequent Visitor

sum filter not working correctly

Hi there, need some help with my formula. I want to extract (based on selectedvalue of slicer) the LATEST date AND LATEST uploadtime and sum the values of those items

 

Current situation:

 

AssetID DealID Marketvalue Effectivedate Uploadtime Enddate Type
1 1 10 01/01/2019 02/01/2019 09:00 office
2 1 10 01/01/2019 02/01/2019 09:00 house
1 1 15 01/01/2019 05/01/2019 09:00 office
1 1 20 01/02/2019 02/02/2019 09:00 office
2 1 20 01/02/2019 02/02/2019 09:00 house
1 1 25 01/02/2019 05/02/2019 09:00 office
1 1 30 01/02/2019 05/02/2019 10:00 01/03/2019 10:00 office

My formula's

Market value totaal = 

VAR Year = YEAR(SELECTEDVALUE(Assets[Effectivedate]))
VAR Month = MONTH(SELECTEDVALUE(Assets[Effectivedate]))
VAR Day = DAY(SELECTEDVALUE(Assets[Effectivedate]))
Var Selectedday = DATE (Year; Month; Day)

var effectiveLAST = 

CALCULATE(  MAX(Assets[EffectiveDate]); FILTER ( allexcept(Assets; Assets[AssetID]; Assets[DealID]); Assets[EffectiveDate] <= Selectedday))

VAR uploadLAST = 

CALCULATE(  MAX(Assets[Uploadtime]); FILTER ( allexcept(Assets; Assets[AssetID]; Assets[DealID]); Assets[EffectiveDate] <= Selectedday))

var som = CALCULATE( SUM( Assets[Marketvalue]) ; Assets[Effectivedate] = effectivelaatste; Assets[Uploadtime] = uploadlaatste )

Return

CALCULATE( SUM( Assets[Marketvalue]);  Assets[Effectivedate] = effectiveLAST; Assets[Uploadtime] = uploadLAST)

This gives me the correct values behind the rows, but not the total / graph for each type.

I tried allexcept (assets; type) and summarize but not working.

 

graph.pngCan anyone help me?

 

Gladly here from you. 

 

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi PowerKoen, 

It seems that you want to get grant total based on current result, right? If so, you could create measure like below, then use this in table or chart

Measure 2 = IF(HASONEVALUE(Assets[AssetID]), [Market value totaal], SUMX(ALLSELECTED(Assets),[Market value totaal]))

349.PNG

Best Regards,
Zoe Zhi

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

View solution in original post

1 REPLY 1
dax
Community Support
Community Support

Hi PowerKoen, 

It seems that you want to get grant total based on current result, right? If so, you could create measure like below, then use this in table or chart

Measure 2 = IF(HASONEVALUE(Assets[AssetID]), [Market value totaal], SUMX(ALLSELECTED(Assets),[Market value totaal]))

349.PNG

Best Regards,
Zoe Zhi

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

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.