Forum Discussion
plmiquelon
4 years agoFrequent Visitor
Create a table based on measured values
+Hi, I would like to see if it would be possible to use values obtained from measure to create a table I want to create a table that has 2 column, one is date and second is cumulative cost. T...
- 4 years ago
You can apply any filters you need by wrapping the whole thing in a CALCULATETABLE call. You can see exactly which filters were applied to your table visual by using Performance Analyzer to get the DAX code used to generate the query for the table.
johnt75
4 years agoSuper User
You need a date table for this approach to work, you can create your table using
New Table = GENERATE( SELECTCOLUMNS('Table', "Start date", 'Table'[start date], "Days", 'Table'[num days], "Cost", 'Table'[Cost]),
DATESBETWEEN( 'Date'[Date], [Start date], [Start date] + [Days] - 1))Then create a relationship between the new table and your date table. You can then create either a measure or a calculated column to show the cumulative cost. A measure would look something like
Cumulative Cost =
var maxDate = MAX('Date'[Date])
return CALCULATE( SUM('New Table'[Cost]), REMOVEFILTERS('Date'), 'Date'[Date] <= maxDate )