Forum Discussion
foreach validate per hour if
Hi all
I need to create a report errors based on the following logic
Success = Record(row) within that hour (ex 18) contains QUALITYOFVALUE "0" or "2"
Error = No record(row) within that hour (ex 18) contains QUALITYOFVALUE "0" or "2"
Ex below
the 12/5 do not contain 0 or 2 within that hour timespan
Any ideas
Br
erik
| METERINGPOINT | RECID | TIMESERIESREFRECID | Year | Quarter | Month | Day | Hour | QUALITYOFVALUE | VALUE |
| 7,35999E+17 | 5637168084 | 5637168084 | 2020 | Qtr 2 | May | 10 | 18 | 0 | 1.159 |
| 7,35999E+17 | 5637168084 | 5637168084 | 2020 | Qtr 2 | May | 10 | 18 | 20 | 0 |
| 7,35999E+17 | 5637168084 | 5637168084 | 2020 | Qtr 2 | May | 11 | 18 | 0 | 1.58 |
| 7,35999E+17 | 5637168084 | 5637168084 | 2020 | Qtr 2 | May | 11 | 18 | 5 | 0 |
| 7,35999E+17 | 5637168084 | 5637168084 | 2020 | Qtr 2 | May | 11 | 18 | 20 | 0.833 |
| 7,35999E+17 | 5637168084 | 5637168084 | 2020 | Qtr 2 | May | 12 | 18 | 5 | 0 |
| 7,35999E+17 | 5637168084 | 5637168084 | 2020 | Qtr 2 | May | 12 | 18 | 20 | 2.931 |
Hi eriweste ,
If you want to show daily succeed or error, we can create a measure to meet your requirement.
Measure = var max_hour = MAX('Table'[Hour]) var max_day = MAX('Table'[Day]) var max_Q = MAX('Table'[Quarter]) var max_Y = MAX('Table'[Year]) var x = CALCULATE("succeed",FILTER(ALLSELECTED('Table'),'Table'[Hour]=max_hour && 'Table'[Day] = max_day && 'Table'[Quarter]=max_Q && 'Table'[Year]=max_Y)) return IF(0 in DISTINCT('Table'[QUALITYOFVALUE]) || 2 in DISTINCT('Table'[QUALITYOFVALUE]),x,"error")The result like this,
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- v-zhenbw-msft
Community Support
Hi eriweste ,
If you want to show daily succeed or error, we can create a measure to meet your requirement.
Measure = var max_hour = MAX('Table'[Hour]) var max_day = MAX('Table'[Day]) var max_Q = MAX('Table'[Quarter]) var max_Y = MAX('Table'[Year]) var x = CALCULATE("succeed",FILTER(ALLSELECTED('Table'),'Table'[Hour]=max_hour && 'Table'[Day] = max_day && 'Table'[Quarter]=max_Q && 'Table'[Year]=max_Y)) return IF(0 in DISTINCT('Table'[QUALITYOFVALUE]) || 2 in DISTINCT('Table'[QUALITYOFVALUE]),x,"error")The result like this,
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.