Forum Discussion
Sarencibia
3 years agoFrequent Visitor
FROM SQL TO DAX
Hi! I need help!!! This is my query SQL: Select (a.cump * 100 / a.total) as perc_error from ( Select ( Select Count(*) from adm.event ev where ev.feature = 'KPIS' and ev.id in ( Selec...
- 3 years ago
Hi , Sarencibia
You can try to create a measure like this:
Test = VAR _total = COUNTROWS ( FILTER ( ALL ( 'adm.event' ), 'adm.event'[feature] = "KPIS" ) ) VAR _event_id = FILTER ( ALL ( 'adm.data' ), 'adm.data'[feature] = "KPIS" && 'adm.data'[jhi_type] = "VALID_WEIGHT" ) VAR _cump = COUNTROWS ( CALCULATETABLE ( FILTER ( ALL ( 'adm.event' ), 'adm.event'[feature] = "KPIS" && 'adm.event'[id] IN _event_id ), CONTAINSSTRINGEXACT ( 'adm.event'[params], "tipo=Pedido" ) || CONTAINSSTRINGEXACT ( 'adm.event'[params], "tipo=Contenedor" ) ) ) RETURN DIVIDE ( _cump * 100, _total )If it dosen't work ,you can provide us with your special sample data (without sensitive data) so that we can help you better.
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
v-yueyunzh-msft
3 years agoCommunity Support
Hi , Sarencibia
You can try to create a measure like this:
Test =
VAR _total =
COUNTROWS ( FILTER ( ALL ( 'adm.event' ), 'adm.event'[feature] = "KPIS" ) )
VAR _event_id =
FILTER (
ALL ( 'adm.data' ),
'adm.data'[feature] = "KPIS"
&& 'adm.data'[jhi_type] = "VALID_WEIGHT"
)
VAR _cump =
COUNTROWS (
CALCULATETABLE (
FILTER (
ALL ( 'adm.event' ),
'adm.event'[feature] = "KPIS"
&& 'adm.event'[id] IN _event_id
),
CONTAINSSTRINGEXACT ( 'adm.event'[params], "tipo=Pedido" )
|| CONTAINSSTRINGEXACT ( 'adm.event'[params], "tipo=Contenedor" )
)
)
RETURN
DIVIDE ( _cump * 100, _total )
If it dosen't work ,you can provide us with your special sample data (without sensitive data) so that we can help you better.
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly