The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
I am facing an issue while creating a DAX calculated measure in tabular model SQL Server 2014.
The dimension table has data like
CategoryCode TypeCode ItemCode ItemSize
C1 P1 1 S
C1 P1 2 M
C1 P1 3 L
C2 P2 4 S
C2 P2 5 M
C3 P3 6 S
C3 P3 7 M
I want to write a DAX expression to calculate
(if count of TypeCodes which fall under CategoryCode C1 and C2 and ItemSize in S,M,L)<>0 then "FR"
((if count of TypeCodes which fall under CategoryCode C1 and C2 and ItemSize in S,L)<>0) AND ((if count of TypeCodes which falls under CategoryCode C1 and C2 and ItemSize in M)=0 then "PR")
Kindly help me in implementing this logic.
Thank You.
Solved! Go to Solution.
Hi Dude ,
Try this one . here i used your first condition only rest of other condition u could add .
Condition Check =
switch ( TRUE(),
CALCULATE( COUNTA(Forum[TypeCode]),FILTER(Forum,
AND( OR( Forum[CategoryCode ] = "C1" , Forum[CategoryCode ] = "C2" ) ,
OR( Forum[ItemSize] = "S" , OR( Forum[ItemSize] = "M", Forum[ItemSize] = "L" )
)
)
)) <> 0 , "FR"
, "Other Condition"
)
Hi Dude ,
Try this one . here i used your first condition only rest of other condition u could add .
Condition Check =
switch ( TRUE(),
CALCULATE( COUNTA(Forum[TypeCode]),FILTER(Forum,
AND( OR( Forum[CategoryCode ] = "C1" , Forum[CategoryCode ] = "C2" ) ,
OR( Forum[ItemSize] = "S" , OR( Forum[ItemSize] = "M", Forum[ItemSize] = "L" )
)
)
)) <> 0 , "FR"
, "Other Condition"
)
Cool. It worked !! Thanks a lot
Always welcome my friend
User | Count |
---|---|
77 | |
76 | |
36 | |
31 | |
29 |
User | Count |
---|---|
93 | |
79 | |
57 | |
48 | |
48 |