Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hoping there is a simple answer on this, but I couldn't find anything in the forums and been scratching my head on this one:
I have a matrix visual with the row field = 'Data'[Test Sceanrio] and Values = Count of 'Data'[Test Case Description] - this uses Count(Distinct)
The results display correctly, but on certain rows that are returned I want to perform calculations on the result for that row e.g. if value = xxx reduce result by 5, else return the unadjusted result
The following DAX query returns the correct values per row, but I want to adjust the result for a specific test case description value.
e.g. IF (Test Case Description = abc, Volume Tested +5, Volume Tested) but I can't include the IF statement correctly in the measure.
Solved! Go to Solution.
Thanks again - got this syntactically correct now, but it did not quite do what I wanted. Did a bit more digging and finally came up with the following which works fine.
Thanks again - got this syntactically correct now, but it did not quite do what I wanted. Did a bit more digging and finally came up with the following which works fine.
No problem! Glad to be helpful 😊
You can use a variable. For eg.
Volume Tested =
var test = CALCULATE(
DISTINCTCOUNTNOBLANK(Data[Test Case Description]),
'Data'[Overall Status Description] in {"OK","Errors","In Process"}
) + 0
Return
IF(
test = 50 //(say),
test - 5,
test
)
Hi Aditya,
Thanks for the quick reply.
Not sure if I am missing something and may have not been that clear in my explanation
I want to test a different field value and decide the calculation based on its value.
I tried the following but get an invalid token syntx error, line 8 offset 1 which is the table field Data[Test Case Description]
If I try to move the IF clause before the Return it flags an invalid token at line 6 offset 19 which is the condition of the IF statement
These are the syntax errors I see which correspond to the line numbers you mentioned
Use 'Data' instead of 'Data
Regards
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
7 | |
7 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |