DAX Query - Filtering out values from a table in powerbi

家住魔仙堡 提交于 2021-02-11 14:48:20

问题


I'm using DAX to do some data analysis in powerbi. Very used to Python, bit lost with DAX.

What I'm trying to do is filter out values from a measure.

Currently the measure is like this,

Measure.Controllable = 
CALCULATE(
    countrows(table_adj_spec_uno), 
    table_adj_spec_uno[column_uno] = "variable 1",
    USERELATIONSHIP(
        'table_adj_spec_uno'[IncidentDate],
        'Table.Date'[DateOnly]
    )
)

I need to filter out this value from this table and column,

table_adj_spec_uno[column_two] <> BLANK()

and

table_adj_spec_uno[column_two] <> "Acceptance_mwap"

How do I count the rows, that include only the values with these things?

Also, if i want to return column two as a measure, without the values above, what DAX query am I looking for?

Appreciate any help.

Thanks!


回答1:


Try with this below changes-

Measure.Controllable = 
CALCULATE(
    countrows(table_adj_spec_uno),
    table_adj_spec_uno[column_uno] = "variable 1",
    table_adj_spec_uno[column_two] <> BLANK(),
    table_adj_spec_uno[column_two] <> "Acceptance_mwap",    
    USERELATIONSHIP(
        'table_adj_spec_uno'[IncidentDate],
        'Table.Date'[DateOnly]
    )
)

OR

Measure.Controllable = 
CALCULATE(
    countrows(table_adj_spec_uno),
    KEEPFILTERS(table_adj_spec_uno[column_uno] = "variable 1"),
    KEEPFILTERS(table_adj_spec_uno[column_two] <> BLANK()),
    KEEPFILTERS(table_adj_spec_uno[column_two] <> "Acceptance_mwap"),    
    USERELATIONSHIP(
        'table_adj_spec_uno'[IncidentDate],
        'Table.Date'[DateOnly]
    )
)


来源:https://stackoverflow.com/questions/63811074/dax-query-filtering-out-values-from-a-table-in-powerbi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!