0

I'm trying to set up a custom filter using DAX in Power BI. The idea is to use a parameter/value extracted from a Slicer. So far, I was able to get the selected value from the Slicer, but I was not able to use it in a filter. The filter expression works perfectly when I manually type the parameter "value", I mean:

FILTER(BI_PRD_MAPA_TRD, BI_PRD_MAPA_TRD[ORIG_GRUPO]="5DSL" || BI_PRD_MAPA_TRD[DEST_GRUPO]="5DSL")

Works just fine, but:

FILTER(BI_PRD_MAPA_TRD, BI_PRD_MAPA_TRD[ORIG_GRUPO]=[Measure] || BI_PRD_MAPA_TRD[DEST_GRUPO]=[Measure])

doesn't work.

The measure is working fine, as I created a "dummy" card to test it. The measure itself is calculated by a DAX SELECTEDVALUE function:

Measure = SELECTEDVALUE(Tabela[GRUPO], "TODOS")

Can someone help me at this topic?

1 Answer 1

0

Get the measure value in a VAR in this DAX and use inside to it, as below.

VAR _SelectedValue = [Measure] RETURN FILTER(BI_PRD_MAPA_TRD, BI_PRD_MAPA_TRD[ORIG_GRUPO]=_SelectedValue || BI_PRD_MAPA_TRD[DEST_GRUPO]=_SelectedValue )

I believe the selection is single select not multiple.

Sign up to request clarification or add additional context in comments.

1 Comment

As far as I understood, DAX is not able to handle the measure as a "value". When I use a constant/string, the filter works as intended, but when I try to associate the measure to the parameter, it doesn't work. That works: FILTRO = VAR PAR = "5DSL" RETURN FILTER(BI_PRD_MAPA_TRD, BI_PRD_MAPA_TRD[ORIG_GRUPO]=PAR || BI_PRD_MAPA_TRD[DEST_GRUPO]=PAR) That doesn't FILTRO = VAR PAR = [GRPSEL] --VAR PAR = "5DSL" RETURN FILTER(BI_PRD_MAPA_TRD, BI_PRD_MAPA_TRD[ORIG_GRUPO]=PAR || BI_PRD_MAPA_TRD[DEST_GRUPO]=PAR) [GRPSEL] is a measure that uses DAX's selectvalues function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.