Hello Forum!
I am relatively new to the BI stuff but have really gotten the bug as of late and have been immersing myself in a wide range of material. That is how I found my way here.
I am currently working on a model trying to generate a report that reflects some basic metrics between data sets containing date values. My question essentially has to do with implementing a conditional filter in a CALCULATE() function. To provide a bit of context, the following is a snapshot of the model diagram view:
https://drive.google.com/open?id=0Bx-m_o41YsVjVDRHc3hPYnpNWm8
A snapshot of the dimension/lookup table:
https://drive.google.com/open?id=0Bx-m_o41YsVjUm1YcDNKZ0wtMU0
Draft report:
https://drive.google.com/open?id=0Bx-m_o41YsVjNjZWeWQ5TExQUm8
And finally, the code for the couple of versions of the measure "Finish Var to 9/5/11" I am attempting to generate:
Version 1:
https://drive.google.com/open?id=0Bx-m_o41YsVjc1IzTXVhZ18zak0
Version 2:
https://drive.google.com/open?id=0Bx-m_o41YsVjX1F0WTFkT3BuaVE
Notes on version 1 of the measure ([Finish Var to 9/5/11]):
1. Wrapped in an IF statement so as to not reflect values on the system level (system example = 6-72C75-10, see Report excerpt link above), am only wanting to show values on schedule version basis (e.g. "DD 9/5/2011", "DD 10/3/2011" etc.)
2. The result-if-true portion of the above broken down as follows:
* [Finish Date] measure defined as:
Finish Date:=IF(HASONEVALUE('d Schedules'[Schedule Designation]),LASTDATE('ALL Sched NOC Data'[Finish]),BLANK())
'ALL Sched NOC Data' is the fact table, and the [Finish] column therein contains date values.
*I am trying to have the report reflect Finish date differences to the earliest schedule in the data set ("DD 9/5/2011") hence its reference in the CALCULATE() filter argument.
Where I am running into the issue is when a particular system has no data for the "DD 9/5/2011" schedule data set. In this case I would like the CALCULATE() filter argument to refer to the "DD 10/3/2011" schedule (the next earliest one). I've tried an IF() as part of the filter argument, and many-a-different approach with no success. Version 2 of the measure is just one such attempt.
In the end, I would like to have the measure
a) return the Finish date difference to the "DD 9/5/2011" date, and if this value is blank for a given system,
b) then to use the "DD 10/3/2011" value in its stead.
c) Reflect blanks if there are no values to be used for comparison
Thank you in advance for considering the issue and for any advice / lessons you can offer!
Cheers,
IG
I am relatively new to the BI stuff but have really gotten the bug as of late and have been immersing myself in a wide range of material. That is how I found my way here.
I am currently working on a model trying to generate a report that reflects some basic metrics between data sets containing date values. My question essentially has to do with implementing a conditional filter in a CALCULATE() function. To provide a bit of context, the following is a snapshot of the model diagram view:
https://drive.google.com/open?id=0Bx-m_o41YsVjVDRHc3hPYnpNWm8
A snapshot of the dimension/lookup table:
https://drive.google.com/open?id=0Bx-m_o41YsVjUm1YcDNKZ0wtMU0
Draft report:
https://drive.google.com/open?id=0Bx-m_o41YsVjNjZWeWQ5TExQUm8
And finally, the code for the couple of versions of the measure "Finish Var to 9/5/11" I am attempting to generate:
Version 1:
https://drive.google.com/open?id=0Bx-m_o41YsVjc1IzTXVhZ18zak0
Version 2:
https://drive.google.com/open?id=0Bx-m_o41YsVjX1F0WTFkT3BuaVE
Notes on version 1 of the measure ([Finish Var to 9/5/11]):
1. Wrapped in an IF statement so as to not reflect values on the system level (system example = 6-72C75-10, see Report excerpt link above), am only wanting to show values on schedule version basis (e.g. "DD 9/5/2011", "DD 10/3/2011" etc.)
2. The result-if-true portion of the above broken down as follows:
* [Finish Date] measure defined as:
Finish Date:=IF(HASONEVALUE('d Schedules'[Schedule Designation]),LASTDATE('ALL Sched NOC Data'[Finish]),BLANK())
'ALL Sched NOC Data' is the fact table, and the [Finish] column therein contains date values.
*I am trying to have the report reflect Finish date differences to the earliest schedule in the data set ("DD 9/5/2011") hence its reference in the CALCULATE() filter argument.
Where I am running into the issue is when a particular system has no data for the "DD 9/5/2011" schedule data set. In this case I would like the CALCULATE() filter argument to refer to the "DD 10/3/2011" schedule (the next earliest one). I've tried an IF() as part of the filter argument, and many-a-different approach with no success. Version 2 of the measure is just one such attempt.
In the end, I would like to have the measure
a) return the Finish date difference to the "DD 9/5/2011" date, and if this value is blank for a given system,
b) then to use the "DD 10/3/2011" value in its stead.
c) Reflect blanks if there are no values to be used for comparison
Thank you in advance for considering the issue and for any advice / lessons you can offer!
Cheers,
IG