Forum Discussion
Anonymous
6 years agoNot applicable
Comparison works weird
The model contains of two tables/entities (note the terms are terms from the model, not from power BI itself): - indicator - data source "indicator" is linked to "data source" as one-to-many: mu...
Anonymous
6 years agoNot applicable
// Don't use floating-point arithmetic if you don't have to. It's inaccurate by nature so
// equality should never be performed on such numbers.
// And here's your column:
[IsDataReady] = // calculated column in indicator
var __allSources = RELATEDTABLE( 'sources' )
var __allSourcesCount = COUNTROWS( __allSources )
var __readySources =
filter(
__allSources,
sources[status] = "ModelReady"
)
var __readySourcesCount =
COUNTROWS( __readySources )
RETURN
__readySourcesCount = __allSources
Best
D
Anonymous
6 years agoNot applicable
After replacing a typo in the last row __readySourcesCount = __allSourcesCount and using actual table/column names, the result is again incorrect.
Also the issue is not related to decimal vs. whole number comparison as it evaluates to false (for calculated column) even for rows where e.g. total sources = 1, format ready sources = 1 and there is a 1/1 division before comparing to 1
See the screenshot
- Anonymous6 years agoNot applicableFirst, the formula is not a measure. It's a calculated column formula. Second, I don't know your model's structure and data. Probably you have to make sure that you count distinct 'something' in source.
It looks like you're trying to use it in a visual as a measure... I'm confused.
Best
D - Anonymous6 years agoNot applicableIt's also possible that you are not following best practices... and hence the problems.
Best
D- Anonymous6 years agoNot applicable
"you are not following best practices"
Not following what exactly?
- Anonymous6 years agoNot applicableThe principles of dimensional design. Too much to talk about.
I can assure you 100% that If you have a dimension with unique members and this dimension is connected 1:* to a fact table and you have 2 measures, [A] and [B], that work correctly for each and every member of the dimension, then a calc column of the form ([A] = [B]) must OUT OF NECESSITY return the correct result.
If it does not, then there must be something wrong with the model.
Best
D
- Anonymous6 years agoNot applicableWhy don't you do
[IsFormatReady] = ([Total Sources] = [format-ready sources] ?
This should give you exactly what you need....
Best
D- Anonymous6 years agoNot applicable
Using this [IsFormatReady] = ([Total Sources] = [format-ready sources]) provides exactly the same results:
- it works correct if formula is used as a definition of a measure- it doesn't work if the same formula is used as a definition of a calculated column