Forum Discussion
Translating an Excel, multi-table, filter formula into a Power BI Table
- 4 years ago
Try this:
AuditorName = VAR _Date = 'DPMO Summary'[Date] VAR _ID = 'DPMO Summary'[Auditor ID] RETURN CALCULATE ( MAX ( WWID[Name] ), REMOVEFILTERS (), WWID[WWID] = _ID, WWID[Issue Date] <= _Date, WWID[Return Date] >= _Date )To get the Picker name, just change the _ID variable to reference the Picker ID column.
- 4 years ago
The most intuitive way would to explicitly check for a blank:
AuditorName = VAR _Date = 'DPMO Summary'[Date] VAR _ID = 'DPMO Summary'[Auditor ID] VAR _Name = CALCULATE ( MAX ( WWID[Name] ), REMOVEFILTERS (), WWID[WWID] = _ID, WWID[Issue Date] <= _Date, WWID[Return Date] >= _Date ) RETURN IF ( ISBLANK ( _Name ), _ID, _Name )You could also use COALESCE for the final line
COALESCE ( _Name, _ID )
It's hard to tell without seeing your tables and how they're named and related.
Making some assumptions, I'd expect the DAX equivalent to be something like this:
SelectName =
VAR _Date = Production[Date]
RETURN
CALCULATE (
MAX ( WWID[Name] ),
WWID[Issue Date] <= _Date,
WWID[Return Date] >= _Date
)
But I can't really tell from the information you've provided.
- DJJR4 years agoFrequent Visitor
Thanks for your help with this. I am missing a way to reference the WWID in the Summary Table with the WWID Table. I need a seperate name to populate in the Auditor and Picker Columns.
- AlexisOlson4 years ago
Super User
Try this:
AuditorName = VAR _Date = 'DPMO Summary'[Date] VAR _ID = 'DPMO Summary'[Auditor ID] RETURN CALCULATE ( MAX ( WWID[Name] ), REMOVEFILTERS (), WWID[WWID] = _ID, WWID[Issue Date] <= _Date, WWID[Return Date] >= _Date )To get the Picker name, just change the _ID variable to reference the Picker ID column.
- DJJR4 years agoFrequent Visitor
Worked like a charm. Thanks for your help.