Forum Discussion
Dynamic Variance Based on Two Date Tables
Hi,
I've spent some time in trying to develop a script that would allow me to create a dynamic variance calculation based on dates from two different tables. The code looks as follows:
You will need to use ISFILTERED or ISCROSSFILTERED to figure out which of the date tables is filtered. What if they both are? Worst case you may have to use inactive relationships or disconnected tables.
4 Replies
- lbendlinSuper User
Sounds very similar to a YoY calculation (apart from the sign). Could you show the data model?
Would you mind showing some sample data and indicate the expected outcome based on that sample data?
- SEMattisAdvocate III
Sure, here's a mock up of the data model:
DM
So the expected outcome is to be able to calculate the variance of the number of rows in the fact_CoworkerHistory (Using a snapshot date column) table depending on which of the date tables I use to filter the no of rows.
- lbendlinSuper User
You will need to use ISFILTERED or ISCROSSFILTERED to figure out which of the date tables is filtered. What if they both are? Worst case you may have to use inactive relationships or disconnected tables.