We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hello,
I am trying to see if there is a way to optimize the measure in the sample attachment. The model details an asset (automobile) with events (EventFacts) on a given date. Each automobile may or may not be associated with a configuration (AssetEventMapping).
What I would like is a distinct count of assets by day (see DateTable) only if the asset has a configuration associate in the AssetEventMapping table.
The model details below show example tables & records with the desired result. As can be seen, assets 6 and 7 do not show up in daily count because they do not contain a record in the mapping table (filtered out via the "in distinct" portion of hte measure).
This measure works fine with small dataset, but my real dataset contains millions of records and this query is taking ~5 seconds.
Thanks
Tables:
Measure:
Solved! Go to Solution.
Hi @sbuster
Please try
Count of Assets Reporting =
COUNTROWS (
DISTINCT (
SELECTCOLUMNS (
FILTER (
EventFacts,
EventFacts[AssetID] IN ( DISTINCT ( AssetEventMapping[AssetID] ) )
),
"@AssetID", EventFacts[AssetId]
)
)
)
Hi @sbuster
Please try
Count of Assets Reporting =
COUNTROWS (
DISTINCT (
SELECTCOLUMNS (
FILTER (
EventFacts,
EventFacts[AssetID] IN ( DISTINCT ( AssetEventMapping[AssetID] ) )
),
"@AssetID", EventFacts[AssetId]
)
)
)
Thanks for you response, that improved performance significantly!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 12 | |
| 10 | |
| 10 | |
| 6 | |
| 5 |