I am new to Dax in Power BI. I have a table that have columns:
"elment_id", "version_Id", "type_name", "type_sorting", "workSet"
AND expected result
is the output result from the Dax query.
I am trying to compare version_Id (x2, x2)
with version_Id (x1, x1) (previous)
if any change happened.
in another word, I am inserting to SQL database objects have always the same "elment_id", "type_name"
but the "type_sorting", "workSet"
sometimes will be updated based on "version_Id",
elment_id | version_Id | type_name | type_sorting | workSet | expected result |
---|---|---|---|---|---|
01 | x1 | Round Duct | 0 | w | |
02 | x1 | Round Duct | 0 | m | |
01 | x2 | Round Duct | 1 | y | True |
02 | x2 | Round Duct | 0 | m | False |
Try with measure, where you should manipulate FILTER part. First we check condition that must by equal (elementID/Type, and version = prev_version), then we add as many or " || " to check if one of them is not equal:
Check =
VAR cc =
MAX (
CALCULATE (
COUNTROWS ( changeCheck ),
FILTER (
ALL ( changeCheck ),
(
SELECTEDVALUE ( changeCheck[elementID] ) = changeCheck[elementID]
&& SELECTEDVALUE ( changeCheck[versionId] ) - 1 = changeCheck[versionId]
&& SELECTEDVALUE ( changeCheck[Type] ) = changeCheck[Type]
)
&& (
IF (
ISBLANK ( SELECTEDVALUE ( changeCheck[Type_Sort] ) ),
"NullVal",
SELECTEDVALUE ( changeCheck[Type_Sort] )
)
<> IF ( ISBLANK ( changeCheck[Type_Sort] ), "NullVal", changeCheck[Type_Sort] )
|| SELECTEDVALUE ( changeCheck[Workset] ) <> changeCheck[Workset]
)
)
),
0
)
RETURN
cc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.