Forum Discussion
Michele_I
2 years agoFrequent Visitor
dynamically exclude records based on user defined conditions
Hi all, and thank you for any suggestion with this little issue. This is a semplified example, but my real model works the same way. I have a projects table (every row is a project) and a Localizat...
- 2 years ago
Michele_I Well, if it works, it works. Probably not how I would have done it. I would have probably done something like:
Budget OK = VAR __Table = FILTER( ADDCOLUMNS('Projects', "__Selected", [Selection Measure]), [__Selected] = 1) VAR __Result = SUMX(__Table, [budget]) RETURN __Result
Greg_Deckler
Community Champion
2 years agoMichele_I Maybe something like this. See PBIX attached below signature.
Selection Measure =
VAR __Municipalities = SELECTCOLUMNS('Municipalities', "municipality", [municipality])
VAR __ProjectID = MAX('Projects'[projectID])
VAR __Localizations = SELECTCOLUMNS(FILTER(ALL('Localizations'), [projectID] = __ProjectID), "__municipality", [municipality])
VAR __Except = EXCEPT(__Localizations, __Municipalities)
VAR __Intersect = INTERSECT(__Localizations, __Municipalities)
VAR __Result = IF(COUNTROWS(__Except) = BLANK() && COUNTROWS(__Intersect) <> BLANK(), 1, 0)
RETURN
__Result