variable
variable

Reputation: 9714

Power bi desktop table visual out of memory on a simple DAX

I have a data model with Customer, Product, Insurer dimensions, and the fact table is FactClaims.

Customer dimension has cId, cName, cCompany, cDOB, cAddress

This links to FactClaims on cId.

On the report I have a table visual having several columns (10) from the FactSales, Product, Insurer tables, and cCompany from the Customer table.

I have the following DAX measure added into this table visual:

Scenario Test =

var vCount = DISTINCTCOUNT(Customer['cName'])

return IF(vCount>1,"scenario x","scenario y")

Upon adding this measure into the table visual, I get the visual exceeded the resources error.

The number of rows in Fact table is 1M, and number of rows in each dimension table is around 8K each.

I tried filtering data (by date, and other filters) such that the table visual contains only 30 rows, even then if I add the above DAX measure to the table, I get the exceeded resources error.

What could be the issue?

Upvotes: 1

Views: 66

Answers (1)

Sam Nseir
Sam Nseir

Reputation: 12101

Your measure Scenario Test is always returning a value which will result in all the rows being returned regardless of filters.

As a test update your measure to:

Scenario Test =
var vCount = DISTINCTCOUNT(Customer['cName'])
return IF(vCount>1,"scenario x", BLANK())

And hopefully the error will disappear.

You'll then need to update your measure to something like the following:

Scenario Test =
  var vCount = DISTINCTCOUNT(Customer['cName'])
  var fCount = COUNTROWS('YourFactTable')
  var result = IF(vCount > 1,"scenario x", "scenario y")

  return IF(fCount > 0, result)

Upvotes: 2

Related Questions