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.
Is there a function to calculate all values up to a filtered date?
Something like
Solved! Go to 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
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.
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.
For more details, please check the pbix as attached.
Regards,
Frank
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
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
94 | |
74 | |
71 | |
64 |
User | Count |
---|---|
143 | |
109 | |
103 | |
82 | |
74 |