Forum Discussion
Anonymous
7 years agoNot applicable
how to write dax query based on sql query?
Hi Team, how to write below sql query in dax expression? select title, hours from table where title like '%gold%' or title like '%silver%' we need to find calcualte hours based on gold o...
- 7 years ago
Hi Anonymous,
Please refer to:
Table = VAR temptab = FILTER ( ADDCOLUMNS ( Table5, "Type", IF ( ISERROR ( FIND ( "Gold", Table5[Title] ) ) = FALSE (), "Gold", IF ( ISERROR ( FIND ( "Silver", Table5[Title] ) ) = FALSE (), "Silver", BLANK () ) ) ), [Type] <> BLANK () ) RETURN GROUPBY ( temptab, [Type], "Total Hours", SUMX ( CURRENTGROUP (), [Hours] ) )Best regards,
Yuliana Gu
Anonymous
7 years agoNot applicable
Thanks for reply
can you please help below requirement .
1. I need to find only Gold and silver records, not others records.
2. Total Hours for(gold and silver) / Hours
Thanks
Kunuthuri
v-yulgu-msft
7 years agoMicrosoft Employee
Hi Anonymous,
Please refer to:
Table =
VAR temptab =
FILTER (
ADDCOLUMNS (
Table5,
"Type", IF (
ISERROR ( FIND ( "Gold", Table5[Title] ) ) = FALSE (),
"Gold",
IF (
ISERROR ( FIND ( "Silver", Table5[Title] ) ) = FALSE (),
"Silver",
BLANK ()
)
)
),
[Type] <> BLANK ()
)
RETURN
GROUPBY ( temptab, [Type], "Total Hours", SUMX ( CURRENTGROUP (), [Hours] ) )
Best regards,
Yuliana Gu
- Anonymous7 years agoNot applicable
Thanks for reply