Forum Discussion
Dax column calculation
- 6 years ago
JCK2 - Yep!
JCK2 OK, trying to come back up to speed on this, what are your formulas for the three columns?
These are the calculations i am using...
Audits due column = CALCULATE(DISTINCTCOUNT(' Audits'[PRID]),VALUES(' Audits'[Compliance Date]))
Audits Over due Column = IF((' Audits'[Compliance Date]< ' Audits'[Date Audit Performed])|| ISBLANK(' Audits'[Date Audit Performed]) && (' Audits'[Compliance Date])< TODAY(),1,0)
Thanks for checking Greg!!
- Greg_Deckler6 years agoCommunity Champion
OK, well here is your circular dependency when you use these together:
Audits due column = CALCULATE(DISTINCTCOUNT(' Audits'[PRID]),VALUES(' Audits'[Compliance Date]))
Audits Over due Column = IF((' Audits'[Compliance Date]< ' Audits'[Date Audit Performed]) || ISBLANK(' Audits'[Date Audit Performed]) && (' Audits'[Compliance Date])< TODAY(),1,0)
So, I don't understand that if the 2 things above are columns, why are you using VALUES? Are these measures or columns in a table?
Really, some SAMPLE data would be incredibly useful. Just make some up that emulates your actual data. Would only need 2 or 3 rows.
- JCK26 years agoHelper III
Greg_Deckler , I've created a sample data set, also tried to explain as i can!
Hope its clear, please let me know if you need more info! Thanks a ton 🙂
Sorry here is the link to https://www.dropbox.com/sh/w1cxxiijhn7060u/AACtywXqUK00HuAKWRP2vstYa?dl=0
Id Site Compliance Date Date Performed Total Due Total Overdue % performed on time 1 Amsterdam 10/03/2020 09/03/2020 1 0 100.00% 2 Utrecht 12/03/2020 10/03/2020 1 0 100.00% 3 Venlo 12/03/2020 10/03/2020 1 0 100.00% 4 Amsterdam 13/03/2020 15/03/2020 1 1 0.00% 5 Lellyan 13/03/2020 1 1 ( over due because not performed) 0.00% 6 Milan 17/03/2020 17/03/2020 1 0 100.00% 7 Rome 12/03/2020 Not counted because there is no complaince date #VALUE! 8 Spain 13/03/2020 14/03/2020 1 0 100.00% 9 Utrecht 13/03/2020 15/03/2020 1 1 0.00% 10 Amsterdam 15/03/2020 15/03/2020 1 0 100.00% 11 Lisbon 15/03/2020 15/03/2020 1 0 100.00% 12 Milan 22/03/2020 22/03/2020 Not counted because the date is in future #VALUE! Total 10 3 70.00% Total Due: Countdistint of id where compliance date is non blank and less than today (ID is unique and there can be multiple audits on same date), so need to take id into consideration for total due - Greg_Deckler6 years agoCommunity Champion
OK, I did it with these two columns:
Total Due 1 = IF(ISBLANK([Compliance Date]) || [Compliance Date] > TODAY(),BLANK(),1) Total Overdue 1 = SWITCH(TRUE(), ISBLANK([Compliance Date]),BLANK(), ISBLANK([Date Performed]) && [Compliance Date] < TODAY(),1, [Date Performed] > [Compliance Date],1, [Compliance Date]>TODAY(),BLANK(), 0 )And this measure:
Measure = DIVIDE(COUNTROWS(FILTER('Table',NOT(ISBLANK([Total Overdue 1])) && [Total Overdue 1] = 0)),SUM('Table'[Total Due 1]))PBIX is attached. I think you have an error in your data for Spain. Spain looks like it is overdue.