Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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
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
Hello,
Excuse me for my non-response, I have not been available these last weeks.
Can you help me?
Hello @Anonymous
I don't know if this will help you.
How to send you a zip or pbix file?
How to send you a zip or pbix file?
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"
"Responses"
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"
)
)
Create a relationship between two tables.
You can filter Responses by dragging Filtered Reponses into the Filters pane.
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".
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.
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.
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,
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.
Proud to be a Super User! | |
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!