Forum Discussion
Filter and Dynamic Result
Hi,
Create this calculated column formula in the Trans Table
=IF(CALCULATE(COUNTROWS(Score),FILTER(Score,Score[StartDate]<=EARLIER(Trans[CourseDateTime])&&Score[EndDate]>=EARLIER(Trans[CourseDateTime])))>0,CALCULATE(SUM(Score[Bonus]),FILTER(Score,Score[StartDate]<=EARLIER(Trans[CourseDateTime])&&Score[EndDate]>=EARLIER(Trans[CourseDateTime]))),CALCULATE(SUM(Score[Default]),FILTER(Score,Score[StartDate]<=EARLIER(Trans[CourseDateTime])&&Score[EndDate]>=EARLIER(Trans[CourseDateTime]))))
Hope this helps.
- Hariharan_R7 years agoSolution Sage
It is not giving the expected result.
Score table's year and Trans table's year should be considered and the value is based on the student logs in. if student B logsin then subject S2 only considered on the Trans table new columns.
Your script showing below result.
- Ashish_Mathur7 years agoSuper User
Hi,
Share data from both tables such that i can paste those in an Excel file. Also, show the exact result you are expecting.
- Hariharan_R7 years agoSolution Sage
Hi
Table: Subject
Subject Student Subject A S1 B S2 C S1 Score StartDate EndDate Year Default Bonus Subject 3/1/2019 1:00 3/3/2019 4:00 2019 5 6 S1 2/1/2018 1:00 4/4/2018 4:00 2018 11 10 S1 4/1/2019 1:00 4/3/2019 4:00 2019 4 2 S2 2/1/2018 1:00 3/6/2018 4:00 2018 12 13 S2 ID CourseDateTime 1 3/1/2019 2:00 2 3/1/2019 3:00 1 3/3/2019 3:00 2 3/4/2019 3:00 3 3/4/2019 0:00 4 3/4/2018 0:00 5 1/1/2018 1:00
If Student A logs in the below result.
Expected result is as like below.ID CourseDateTime Default/Bonus CourseDateTime + (Default/Bonus) 1 3/1/2019 2:00 6 3/1/2019 8:00 2 3/1/2019 3:00 6 3/1/2019 9:00 1 3/3/2019 3:00 6 3/1/2019 9:00 2 3/4/2019 3:00 5 3/4/2019 9:00 3 3/4/2019 0:00 5 3/4/2019 5:00 4 3/4/2018 0:00 10 3/4/2018 10:00 5 1/1/2018 1:00 11 1/1/2018 0:00 If Student B logs in
ID CourseDateTime Default/Bonus CourseDateTime + (Default/Bonus) 1 3/1/2019 2:00 4 3/1/2019 6:00 2 3/1/2019 3:00 4 3/1/2019 7:00 1 3/3/2019 3:00 4 3/1/2019 7:00 2 3/4/2019 3:00 4 3/4/2019 7:00 3 3/4/2019 0:00 4 3/4/2019 4:00 4 3/4/2018 0:00 13 3/4/2018 13:00 5 1/1/2018 1:00 12 1/1/2018 13:00 The logic for the Default /Bonus column should be
if(CourseDateTime>Score.StartDate
&& CourseDateTime<Score.EndDate, Bonus, Default)