Forum Discussion
Anonymous
6 years agoNot applicable
I can't create an aggregation table
Hi, I have a datatable with daily about 2,000,000 records and need to keep the records of 32 consecutive dates in de Power BI data model. The table is refreched every day: the earliest data disa...
Icey
Community Support
6 years agoHi Anonymous ,
Please check if this is what you want:
1. Enter another table.
2. Create a measure like so:
Measure =
SWITCH (
TRUE (),
SELECTEDVALUE ( Metric[Metric] ) = "Metric_01", DIVIDE (
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Metric_01] = 1
&& 'Table'[Date] <= MAX ( 'Table'[Date] )
)
),
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Date] <= MAX ( 'Table'[Date] ) )
)
),
SELECTEDVALUE ( Metric[Metric] ) = "Metric_02", DIVIDE (
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Metric_02] = 1
&& 'Table'[Date] <= MAX ( 'Table'[Date] )
)
),
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Date] <= MAX ( 'Table'[Date] ) )
)
),
SELECTEDVALUE ( Metric[Metric] ) = "Metric_03", DIVIDE (
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Metric_03] = 1
&& 'Table'[Date] <= MAX ( 'Table'[Date] )
)
),
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Date] <= MAX ( 'Table'[Date] ) )
)
),
SELECTEDVALUE ( Metric[Metric] ) = "Metric_04", DIVIDE (
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Metric_04] = 1
&& 'Table'[Date] <= MAX ( 'Table'[Date] )
)
),
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Date] <= MAX ( 'Table'[Date] ) )
)
),
SELECTEDVALUE ( Metric[Metric] ) = "Metric_05", DIVIDE (
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Metric_05] = 1
&& 'Table'[Date] <= MAX ( 'Table'[Date] )
)
),
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Date] <= MAX ( 'Table'[Date] ) )
)
)
)
3. Create a line chart.
For more details, please check the attached PBIX file.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous6 years agoNot applicable
Thanks,
This was the sollution I already had more or less.
I wanted to use an aggregate table, so that on the moment we start using millions of records per date the measure wouldn't take too long.R.W.