Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a measure which counts how many passes and fails there are in a dataset called 'Loaders&Assessors Results' in a column called [Result]
The audit date is in a table called 'Loaders&Assessors' and is called [Date Audited]
The fail measure in its current form is
Fail = CALCULATE(COUNTA('Loaders&Assessors Results'[Result]),FILTER('Loaders&Assessors Results','Loaders&Assessors Results'[Result]="Fail"))
I would like to add two additional measures, for current and previous month. I tried myself and failed.
Solved! Go to Solution.
Hi @Anonymous
I have tested this one in one of my datasets and it worked, give it a try:
Previous Month Fail = CALCULATE(COUNTA('Loaders&Assessors Results'[Result]),FILTER('Loaders&Assessors Results','Loaders&Assessors Results'[Result]="Fail"),DATESBETWEEN('Loaders&Assessors'[Date Audited],DATE(YEAR(TODAY()),MONTH(TODAY())-1,01),DATE(YEAR(TODAY()),MONTH(TODAY()),01)-1))
Hope it helps!
First make sure you have a relationship established between 'Loaders&Assessors' and 'Loaders&Assessors Results', then try this:
Previous Month Fail = CALCULATE(COUNTA('Loaders&Assessors Results'[Result]),FILTER('Loaders&Assessors Results','Loaders&Assessors Results'[Result]="Fail"), PREVIOUSMONTH('Loaders&Assessors'[Date Audited])) Current Month Fail = CALCULATE(COUNTA('Loaders&Assessors Results'[Result]),FILTER('Loaders&Assessors Results','Loaders&Assessors Results'[Result]="Fail"), DATESBETWEEN('Loaders&Assessors'[Date Audited],DATE(YEAR(TODAY()),MONTH(TODAY()),1),ENDOFMONTH(DATE(YEAR(TODAY()),MONTH(TODAY()),1))))
Hi and thanks @Anonymous
The measures don't quite work, I had tried the exact same previousmonth measure as you, and it returns no value although I can't see what the issue is!
The current month measure errored, I have played around with it and it seems the below is pulling through the correct number:
Current Month Fail = CALCULATE(COUNTA('Loaders&Assessors Results'[Result]),FILTER('Loaders&Assessors Results','Loaders&Assessors Results'[Result]="Fail"), DATESBETWEEN('Loaders&Assessors'[Date Audited],DATE(YEAR(TODAY()),MONTH(TODAY()),1),ENDOFMONTH('Loaders&Assessors'[Date Audited])))
If you can think of a reason why the previousmonth measure it's pulling through a number, let me know!
Hi @Anonymous
I have tested this one in one of my datasets and it worked, give it a try:
Previous Month Fail = CALCULATE(COUNTA('Loaders&Assessors Results'[Result]),FILTER('Loaders&Assessors Results','Loaders&Assessors Results'[Result]="Fail"),DATESBETWEEN('Loaders&Assessors'[Date Audited],DATE(YEAR(TODAY()),MONTH(TODAY())-1,01),DATE(YEAR(TODAY()),MONTH(TODAY()),01)-1))
Hope it helps!
It works! Hurrah! Thanks so much @Anonymous
Happy to help 🙂
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
97 | |
80 | |
66 | |
62 |
User | Count |
---|---|
145 | |
113 | |
105 | |
85 | |
65 |