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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
gorgo
Frequent Visitor

Filter All not working when field is not in the table

Hi Everyone, 

i have a problem with my query, could not find the solution for it. I appreciate if you can assist.

below is a screen shot of my report :

 

 
 

Report Screen shot.jpg

 

below is some explanation of the report

in table 3, i am calculating cumulative ceded premium based on the below formula:

 

 

 

Cumulative Ceded Premium = CALCULATE (      
   [Our Share of GCP],      
   FILTER (      
      ALL ( LineReport[Index Year] ),      
      LineReport[Index Year] <= MAX ( LineReport[Index Year])  
   )    
)

 

 

Index Year is in columns (1,2,3,4,5,6,7,8)

 

the above is working fine.

 

My problem is in table 1, where i should retreive the cumulative amount for a specific year (without putting the year in Rows)

for example:  in Table 1 (look only first row Premium, 3 years) Coumn Index Year 7, i should get 125,816,623 (Table 3 , Column Index Year 7, Row UW Year 2014 which is the max UW year for index year 7), while im getting 143,406,566 which is the amount showing in Column index 6 , UW Year 2014 in Table 1). it is always taking the info from previous year.

 

note that if i put the field UW Year the amounts are displayed properly: check table 2 Index Year 7, UW Year 2014, the amount is 125,816,623.

 

i tried many formulas using Filter All functions but none of them worked to give me the correct amount:

 

 

Premium 3 Years = 
CALCULATE (     
   [Our Share of GCP],      
   FILTER (      
      ALL( LineReport[Index Year],LineReport[UW Year] ),      
      AND(LineReport[Index Year] <= MAX ( LineReport[Index Year]), LineReport[UW Year]=MAX(LineReport[UW Year])
   )    
)  
   
)

 

 

 

also i tried:

 

 

Premium 3 Years = 
CALCULATE (     
   [Cumulative Ceded Premium],      
   FILTER (      
      ALL( LineReport[UW Year] ),      
      LineReport[UW Year]=MAX(LineReport[UW Year])
   )    
)  
   

 

 

 even i put single value 2014 instead of Max(LineReport[UW Year]), i get same results.

 

appreciate your assistance the soonest possible.

 

Thank you in advance.

 

Best regards

Georges Sabbagh

3 REPLIES 3
Anonymous
Not applicable

Without knowing the structure of the model it's not possible to answer this.

Best
D

Hi again,

thank you for your feedback, let me try to simplify the problem.

 

below is a sample of data, i need to calculate the cumulative amount by IndexYear.

 

Entity

UWYear

IndexYear

Premium

Cyprus

2014

5

100

Cyprus

2014

5

50

Cyprus

2014

6

200

Cyprus

2014

6

100

Dubai

2014

5

50

Dubai

2014

5

50

Dubai

2014

6

100

Dubai

2014

7

200

SAL

2015

8

500

Cyprus

2013

5

10

Cyprus

2013

5

10

Cyprus

2013

6

10

Cyprus

2013

6

10

Dubai

2013

5

10

Dubai

2013

5

10

Dubai

2013

6

10

Dubai

2013

7

10

SAL

2013

8

10

 

i am using the below formula:

 

Cumulative Premium = CALCULATE ( SUM(Data[Premium]), FILTER ( ALL ( Data[IndexYear] ), Data[IndexYear] <= MAX ( Data[IndexYear] ) ) )

 

the issue is that i need to calculate cumulative by indexyear for each UWYear, even if entity doesnt have a value for a specify indexyear, i need to calculate the premium for the whole UWYear.

 

the results are as per the below:

 

UWYear

5

6

7

8

Grand Total

2014

250

400

200

 

850

2015

 

 

 

500

500

 

while it should be 

 

UWYear

5

6

7

2014

250

650

850

 

below is how Entity is distributed:

 

Entity

5

6

7

8

Total

Cyprus

150

300

 

 

450

Dubai

100

100

200

 

400

SAL

 

 

 

500

500

 

As you can see in index it is not calculating the cumulative properly since in Cyprus I don’t have any rows for index 7.

It is calculating the cumulative for Dubai disregarding the cumulative of Cyprus (as at column 6)

 

The output should calculate all the cumulative amounts less than or equal to 7 (both Cyprus and Dubai cumulative instead of only Dubai)

 

i tried to attached screen shots but didnt work so i pasted only tables.

 

i hope i clarified the problem

 

appreciate your assistance

 

Best regards,

 

 

 

 

 

AllisonKennedy
Super User
Super User

Try using DATEADD here and you will need to have some context of YEAR on that table visualization in order to tell Power BI what year is the starting point. DATEADD can then be used to count backwards 3, 7, etc years.

 

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 

 

If you found this post helpful, please give Kudos.

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 

https://sites.google.com/site/allisonkennedycv


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors