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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
kunjan_ashara
New Member

Filter data using slicer

Hello Everyone, 

I have this tableau calculation where [Include in MPR Para] is a Tableau parameter and INCLUDE_IN_MPR is a column.
if [Include in MPR Para] = 'Included in MBO' and ([INCLUDE_IN_MPR]) = TRUE then TRUE
elseif [Include in MPR Para] = 'Excluded from MBO' and ([INCLUDE_IN_MPR]) in (FALSE/*,Null*/) then TRUE
elseif [Include in MPR Para] = 'All' and ([INCLUDE_IN_MPR]) in (True, False, Null) then TRUE
else FALSE end
I would like to replicate this in power bi.
I have created a disconnected table in Power BI with two values, 'Included in MBO' and 'All'. I tried to replicate the calculation with the below dax but it is not working.
Calc_Dax = 

VAR sel = SELECTEDVALUE('Show Categories'[Value])
RETURN

IF(
    sel = "Included in MBO",
    IF( MAX(APEX_INTL_MSF_FACT[INCLUDE_IN_MPR]) = "TRUE", 1, 0 ),
    1
)
5 REPLIES 5
cengizhanarslan
Super User
Super User

Please try the measure below:

Calc_Dax =
VAR _Sel =
    SELECTEDVALUE ( 'Show Categories'[Value] )
VAR _IncludeFlag =
    MAX ( APEX_INTL_MSF_FACT[INCLUDE_IN_MPR] )
RETURN
    SWITCH (
        TRUE (),
        _Sel = "Included in MBO"   && _IncludeFlag = TRUE (),  1,
        _Sel = "Excluded from MBO" && _IncludeFlag <> TRUE (),  1,
        _Sel = "All",                                            1,
        0
    )

 

Then apply this measure as a visual-level filter set to is 1 on your visuals.

_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.
jgeddes
Super User
Super User

The following replicates your tableau calculation.

Calc_DAX = 
var _paraValue = 
SELECTEDVALUE('Show Categories'[Value])
var _tableValue = 
SELECTEDVALUE(apex_intl_msf_fact[Include_in_mpr])
var _result = 
SWITCH(
    TRUE(),
    _paraValue = "Included in MBO" && _tableValue = TRUE(), TRUE(),
    _paraValue = "Excluded from MBO" && _tableValue IN {FALSE()}, TRUE(),
    _paraValue = "All" && (_tableValue IN {TRUE(), FALSE()} || ISBLANK(_tableValue)), TRUE(),
    FALSE()
)
RETURN
_result

jgeddes_0-1777039573273.pngjgeddes_1-1777039590684.png

 

 





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

Proud to be a Super User!





wardy912
Super User
Super User

Hi @kunjan_ashara 

 Try this:

Calc_Dax =
VAR Sel =
    SELECTEDVALUE ( 'Show Categories'[Value], "All" )
VAR IncludeFlag =
    MAX ( APEX_INTL_MSF_FACT[INCLUDE_IN_MPR] )
RETURN
SWITCH (
    TRUE(),

    -- Included in MBO
    Sel = "Included in MBO"
        && IncludeFlag = TRUE(), 1,

    -- Excluded from MBO
    Sel = "Excluded from MBO"
        && ( IncludeFlag = FALSE() || ISBLANK ( IncludeFlag ) ), 1,

    -- All
    Sel = "All", 1,

    0
)

 
Once you've added the measure to a slicer, change the visual level filter to 'is 1' in the right hand filter pane as shown in the screenshot

wardy912_0-1777039234655.png

--------------------------------

I hope this helps, please give kudos and mark as solved if it does!

 

Connect with me on LinkedIn.

Subscribe to my YouTube channel for Fabric/Power Platform related content!




danextian
Super User
Super User

hI @kunjan_ashara 

Is INCLUDE_IN_MPR a logical (TRUE/FALSE) column or a text column containing the word "TRUE"? If it is a logical type, the values should appear italicized in Data view, and the comparison should use TRUE() rather than "TRUE".

 

Also, the result of MAX(APEX_INTL_MSF_FACT[INCLUDE_IN_MPR]) can change depending on where the measure is being evaluated. In a visual, each row can have its own filters (for example a specific customer, product, or month), and the measure is calculated only using the data visible for that row.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
mh2587
Super User
Super User

_Flag = --try this might help you
VAR sel = SELECTEDVALUE('Show Categories'[Value])
RETURN
SWITCH(
    TRUE(),

    sel = "Included in MBO" && SELECTEDVALUE(APEX_INTL_MSF_FACT[INCLUDE_IN_MPR]) = TRUE(), 1,

    sel = "Excluded from MBO" &&
        (SELECTEDVALUE(APEX_INTL_MSF_FACT[INCLUDE_IN_MPR]) = FALSE()
        || ISBLANK(SELECTEDVALUE(APEX_INTL_MSF_FACT[INCLUDE_IN_MPR]))), 1,

    sel = "All", 1,

    0
)

✔ Answered? Mark as solution

Muhammad Hasnain | Super User • Fabric • Power BI • Data Engineering

Let's connect on LinkedIn

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.