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

calculate filter Lastdate apply to multigroups (DAX)

I want to do a specific calcul with DAX in power BI.

I want to apply last_update function to have the lastupdate cumul_Value of each group :

 

I have a database looks like :

 

cumul_Value = sum(Value)

 

time   Group    cumul_Value

1/1     A           2

2/1     A           4

3/1     A           5
1/1     B           4

2/1     B           5

3/1     B           9

1/1     C           3

2/1     C           4

3/1     C           5

 

I want to apply DAX forlmula to create the table:

 

 

time   Group   cum_value_last_update

3/1     A           5

3/1     B           9

3/1     C           5

 

 

 



 

I was using CALCULATE, FILTER  :

 

last_update = FILTER(
ALL([time]) ;
[time]= MAX([time]) )

 

cum_value_last_update= CALCULATE( [cumul_Value];
FILTER(
ALL(time) ;
time= last_update )
)

 

this function return a unique value for all groups...

 

 

 

I want to apply the last update filter to have the cumul_values of each groups A, B ,C

 

Do you have a solution ?

 

1 ACCEPTED SOLUTION

How about this

 


cum_value_last_update= CALCULATE( [cumul_Value];
Lastnonblank( calendar[time],1))

 

dont put date in the table, just group and the above measure. I think it will work. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

4 REPLIES 4
Baskar
Resident Rockstar
Resident Rockstar

Hi matheiu,

 

Measure = Calculate (Sum(Cum_Value),Filter(All("Time"),Time=Max(Time)),

 

Try this one it will help u if not let me know. i will help u

 

 

Eric_Zhang
Employee
Employee

@mathieu_thelot

 

Just change the measure as

cum_value_last_update = 
CALCULATE(sum(sampleTbl[cumul_Value]),
FILTER(
ALL(sampleTbl[time]) ,
sampleTbl[time]= MAX([time]) )
)

捕获.PNG

 

I try it and that works but not so strong with the Total. 

That retruns for my total the C group value ... 

 

Is there a way to filtrer last value of my groups when dates wasn't the same

 

 

=========================================> time

 

A

============== 03/01/2016

 

B

====== 01/01/2016

 

C

=========================================10/01/2016

How about this

 


cum_value_last_update= CALCULATE( [cumul_Value];
Lastnonblank( calendar[time],1))

 

dont put date in the table, just group and the above measure. I think it will work. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

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.