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.
Hi can someone pls tell me whats wrong with the below formula -
= if(SUM('Install Count Devices'[Installed Device Quantity]) = 0, blank(),DIVIDE([Failure Count],[Installed Device Quantity],0))
When I added this in SSAS Tabular model as a calculated column, I get error as below
"Installed Device Quantity is not found or cannot be used in this expression". And the error is with the second instance of [Installed Device Quantity] in the formula. Can someone tell me whats wrong with the Divide function or what else.
Thanks
Solved! Go to Solution.
Thanks All for the inputs. I got it resolved by making installed device quantity as a meausre instead of calculated oclumn.
Thanks All for the inputs. I got it resolved by making installed device quantity as a meausre instead of calculated oclumn.
Hi @Anonymous,
Thanks for your sharing. Please kindly mark your shared solution as an answer so that others having similar problem can find the solution more easily.
Regards,
Yuliana Gu
agree with diblet17. no need of the last 0
Measure = if(SUM('Install Count Devices'[Installed Device Quantity]) = 0, blank(),DIVIDE([Failure Count],[Installed Device Quantity],0))
@mattbrice@Anonymous@Anonymous I guess the problem is with the divide function having numerator from one table and denominator from another table. Is that a valid case to divide one field by another field from two different tables in SSAS.
@AnonymousYou could test this theory by declaring a variable and putting the 'other table' value into the variable. Then use the variable in your divide.
Is the column in the table : 'Install Count Devices' ? The first time you used it you fully qualified the column name, second time you did not. Try fully qualifying it: 'Install Count Devices'[Installed Device Quantity].
This is a best practice anyway for code readability. Columns include table name, measures do not.
Also if this is a calculated column, the expression "SUM('Install Count Devices'[Installed Device Quantity])" will SUM all the values in the entire 'Installed Device Quantity' column in the 'Install Count Devices' table as you have no context transition happening. CALCULATE needed for that.
Hi,
It's my understanding that the divide function handles dividing by zero on it's own so there's no need for the IF(SUM() = 0, BLANK(), DIVIDE()) statement, that could simply be written as:
Divide(Col1, Col2, BLANK())
with the third argument being the output when you divide by zero, which is what the IF() statement was doing.
I don't think this helps with your error however, it seems unrelated. Try simplifying the code as suggest and perhaps it will become more clear?
Thanks,
Will
Without knowing your full data structure, is the table in which you are creating this custom column the same table that has the column [Failure Count] and [Installed Device Quantity]?
The way you have referenced them assumes that are on the same data row as the created column as it runs. Is this actually the case in your tables?
@Anonymous The column [Failure Count] is in the same table where I am adding the calculated column. But the column [Installed Device Quantity] is in a different table (table name - Install count devices) and it is a calculated column in that table. The formula
Failure % = if('Install Count Devices'[Installed Device Quantity] = 0, blank(),[Failure Count]/[Installed Device Quantity]) worked in Power BI but not working in SSAS. And there is no relationship between the two tables.
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 |
---|---|
114 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |