Forum Discussion
Marek_Wojciech
2 years agoFrequent Visitor
Problem with correctly filtering a fact table based on another table
Hi, I'm taking my first steps in DAX and I have a simple model consisting of two tables. I created two measures (Generation and Generation1), the first returns the sum of generations, the second also...
parry2k
2 years agoSuper User
Marek_Wojciech try this:
Gen 1 Measure =
VAR __ComDate = MIN('tblUnits'[ComDate])
VAR __DeComDate = MIN('tblUnits'[DeComDate])
RETURN
SUMX(
FILTER (
'tblGeneration',
'tblGeneration'[Date] <= __DecComDate &&
'tblGeneration'[Date] >= __ComDate
),
'tblGeneration'[power]
)Marek_Wojciech
2 years agoFrequent Visitor
Thank you for your answer, although the generation for individual units is correct, the summary is still wrong. It should be 133, not 164. This is the sum of the generation for each unit in the range between the ComDate and DeComDate dates of each unit (without generation on these days - in the measure >,< and not >= ,<=).