Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello everyone!
I have a huge transactional table that shows me the Actuals vs. Target for machines, per row.
The structure is as follows:
| DateTime | DateEnd | Machine | Actual | Target |
| 01.01.2021 00:05:00 | 01.01.2021 01:05:00 | 1 | 5 | 4 |
| 01.01.2021 01:05:00 | 01.01.2021 02:05:00 | 1 | 5 | 4 |
| 01.01.2021 02:05:00 | 01.01.2021 05:05:00 | 1 | ||
| 01.01.2021 05:05:00 | 01.01.2021 06:00:00 | 1 | 4 |
As you can see, there are three cases to distinguish here:
Now I want to calculate the average for the column "Targets".
The second case - no actuals/targets - should not be included.
In the third case - only actuals - the target should be equal to the actuals.
Unfortunately, the following approach does not give me a correct value for targets:
Target =
VAR _Check = IF(ISBLANK(AVERAGE(data[target])),[Actual],AVERAGE(data[target]))
RETURN
_Check
Hi @joshua1990
Try this.
Target =
CALCULATE (
AVERAGEX ( data, IF ( ISBLANK ( data[target] ), data[actual], data[target] ) ),
data[target] <> BLANK (),
data[actual] <> BLANK ()
)
If it is too slow we'll try another approach
|
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 17 | |
| 9 | |
| 8 | |
| 7 |