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
KarlNixon
Advocate I
Advocate I

Date formula All values to a max date?

Is there a function to calculate all values up to a filtered date?

 

Something like 

 

Total Qty quoted alltime = CALCULATE (
SUMX (quotation_data_tab,[Qty] ),
FILTER (
ALL ( quotation_data_tab[bi_sd_so_order_date]),
quotation_data_tab[bi_sd_so_order_date]<= MAX (quotation_data_tab[bi_sd_so_order_date])
)
)
 
 
cumulative example.JPG
 
But where the date filter applied only applies to the maximum date and includes all lesser dates.
 
If I apply a filter to the view (ie March 2018) I only get the result for that selection, not all prior date values?
 
cumulative example 2.JPG
 
Help appreciated Smiley Wink
1 ACCEPTED SOLUTION

Hi @KarlNixon,

 

If there is relationship between data table and the fact tabel, once you choose any value in the slicer. Then the fact table will be filterd accrodingly. Then you cannot get the result as you want in the table visual. However for the value in the card, we can use ALL function to ignore the filer. So we can update the measure as below to work on it.

 

Measure 2 = CALCULATE(SUM(Table1[qty]),FILTER(ALL(Table1),Table1[date]<=MAX('CALENDAR'[Date])))

For more detaills, please check the pbix as attacched.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

 

Ensure you have a Calendar Table with a relationship from the Date column of the quotation_data_tab Table to the Date column of the Calendar Table.  Drag the Dates from the Calendar Table to the slicer.  Write this measure

 

=CALCULATE([Qty],DATESBETWEEN(Calendar[Date],MINX(ALL(Calendar),Calendar[Date]),MAX(Calendar[Date]))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-frfei-msft
Community Support
Community Support

Hi @KarlNixon,

 

I made one sample for your referece. Please check the following steps as below.

 

1. Create a CALENDAR table and create a calculated column in it.

 

CALENDAR = CALENDARAUTO()
Yearmonth = FORMAT('CALENDAR'[Date],"yyyymmm")

2. Create the measures as below.

 

Measure = var maxdt = MAX('Table1'[date])
var maxdc = MAX('CALENDAR'[Date])
return 
IF(maxdc>=maxdt,1,0)
Measure 2 = CALCULATE(SUM(Table1[qty]),FILTER(Table1,Table1[date]<=MAX('CALENDAR'[Date])))

Please filter the table visual by the measure as the picture as below. 

Capture.PNG

 

For more details, please check the pbix as attached.

 

Regards,

Frank

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @KarlNixon,

 

If there is relationship between data table and the fact tabel, once you choose any value in the slicer. Then the fact table will be filterd accrodingly. Then you cannot get the result as you want in the table visual. However for the value in the card, we can use ALL function to ignore the filer. So we can update the measure as below to work on it.

 

Measure 2 = CALCULATE(SUM(Table1[qty]),FILTER(ALL(Table1),Table1[date]<=MAX('CALENDAR'[Date])))

For more detaills, please check the pbix as attacched.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Thanks for your help Frank - all solved!

 

 

 

 

Hi Frank,

 

It looks like the solution won't work if there is a relationship between the Table1[Date] field and the Calander[Date] field

 

I'm perplexed as to why?

 

 

Karl

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.