Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
MathieuF
Helper III
Helper III

Make a DAX formula that filters a column

Hello,
I would like to make a DAX formula that filters a column.
Here is what I want to do:

Test 2 =
VAR Selection = SELECTEDVALUE(Filtre_Relance[Filtre])
RETURN
SWITCH(
TRUE(),
Selection = "Avec", FILTRE(responses, responses[Reponses] = "oui"),
Selection = "Sans", FILTRE(responses, responses[Reponses] = "non"),
BLANK()
)

How to do it?
Thank you very much

9 REPLIES 9
MathieuF
Helper III
Helper III

Hello,
I can't share the file directly with you.
https://drive.google.com/file/d/1_wg-Z4rxWlvLLDEvoM60v3HyvJVRaCaz/view?usp=drive_link

In fact, I would like a segment (WITH/WITHOUT). WITH = yes, no and empty WITHOUT = no and empty

Thanks

MathieuF
Helper III
Helper III

Hello,
Excuse me for my non-response, I have not been available these last weeks.
Can you help me?

MathieuF
Helper III
Helper III

Hello @Anonymous 
I don't know if this will help you.

How to send you a zip or pbix file?

 

MathieuF_1-1724930951156.png

 

MathieuF_0-1724930908615.png

 

How to send you a zip or pbix file?

Anonymous
Not applicable

Hi @MathieuF 

 

Thank you very much DataNinja777 and rajendraongole1 for your prompt reply.

 

Allow me to give you another idea for reference.

 

Here's some dummy data

 

"Filtre_Relance"

vnuocmsft_0-1724835046902.png

 

"Responses"

vnuocmsft_1-1724835244665.png

 

You can create a calculation column to determine the Reponses corresponding to different filters.

 

Filtered Reponses = 
VAR Selection = Filtre_Relance[Filtre]
RETURN
    IF(
        Selection = "Avec", "oui",
        IF(
        Selection = "Sans", "non",
        "other"
    )
)

 

vnuocmsft_2-1724835384414.png

 

Create a relationship between two tables.

 

vnuocmsft_3-1724835453516.png

 

You can filter Responses by dragging Filtered Reponses into the Filters pane.

 

vnuocmsft_4-1724835557602.png

 

vnuocmsft_5-1724835735326.png

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Hello @Anonymous ,
Thank you for your quick response.
I tested but I need to adjust my request.
If I select "With" I need it to show me the results "yes" and/or "no".
If I select "Without" I need it to show me only the results "no".

Anonymous
Not applicable

Hi @MathieuF 

 

Can you provide some virtual data and expected results? It is best presented in a tabular form, which helps you solve the problem. Delete sensitive data.

MathieuF
Helper III
Helper III

Thanks for your answers.
@rajendraongole1 
Actually, I don't want this measure to calculate anything but to apply a filter to my entire visual.

@DataNinja777 
I have an error.
The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

DataNinja777
Super User
Super User

Hi @MathieuF ,

You can try the calculatetable function to return a filtered table:

Test 2 =
VAR Selection = SELECTEDVALUE(Filtre_Relance[Filtre])
RETURN
    SWITCH(
        TRUE(),
        Selection = "Avec", CALCULATETABLE(responses, responses[Reponses] = "oui"),
        Selection = "Sans", CALCULATETABLE(responses, responses[Reponses] = "non"),
        BLANK()
    )

 Best regards,

rajendraongole1
Super User
Super User

Hi @MathieuF -you can create a DAX measure that filters a column based on a selection made through a slicer or other selection method with combination of switch and filter.

 

Measure:

Test 2 Measure =
VAR Selection = SELECTEDVALUE(Filtre_Relance[Filtre])
RETURN
SWITCH(
TRUE(),
Selection = "Avec",
CALCULATE(
COUNTROWS(responses),
FILTER(responses, responses[Reponses] = "oui")
),
Selection = "Sans",
CALCULATE(
COUNTROWS(responses),
FILTER(responses, responses[Reponses] = "non")
),
BLANK()
)

 

Hope this helps.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors