Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
There are two table. They are unrelated.
- Table "Groups"
- Table "MyCalendar"
I need to add two calculated columns to MyCalendar. The values for these columns have to be retrieved from Groups. The condition upon which the retrieval has to be done is that MyCalendar[Date] value has to be between Groups[StartDate] and Groups[EndDate].
What DAX code for these calculated columns could be?
I would be glad to be guided.
I made a sample with data:
https://www.dropbox.com/s/10mwguj9y5vmic0/GetValuesFromUnrelatedTable.pbix?dl=0
Solved! Go to Solution.
@Sergiy ,
You can create two calculate columns based on table 'MyCalendar' using dax below:
GroupID = VAR CurrentDate = MyCalendar[Date] RETURN CALCULATE(MAX(Groups[Id]), FILTER(Groups, Groups[StartDate] <= CurrentDate && Groups[EndDate] >= CurrentDate)) GroupName = VAR CurrentDate = MyCalendar[Date] RETURN CALCULATE(MAX(Groups[Name]), FILTER(Groups, Groups[StartDate] <= CurrentDate && Groups[EndDate] >= CurrentDate))
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Sergiy ,
You can create two calculate columns based on table 'MyCalendar' using dax below:
GroupID = VAR CurrentDate = MyCalendar[Date] RETURN CALCULATE(MAX(Groups[Id]), FILTER(Groups, Groups[StartDate] <= CurrentDate && Groups[EndDate] >= CurrentDate)) GroupName = VAR CurrentDate = MyCalendar[Date] RETURN CALCULATE(MAX(Groups[Name]), FILTER(Groups, Groups[StartDate] <= CurrentDate && Groups[EndDate] >= CurrentDate))
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
125 | |
106 | |
99 | |
63 | |
62 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |