Forum Discussion

CoderV9's avatar
CoderV9
New Member
1 year ago
Solved

Issue with DAX Filter via Web URL

Hi All, I have a table named tbl_incidents that contains ServiceNow incident data. I’m working on a matrix grid visualization in PowerApps that displays incident records based on a given User ID and...
  • v-venuppu's avatar
    1 year ago

    Hi CoderV9 ,

    You are absolutely right - hardcoding values like 202501 or "WXYZ" inside the DAX won't allow dynamic filtering through the URL or PowerApps.

    Here's how to make your DAX work with URL filters:
    You don't need to extract values manually into variables (like varDate, varMgrID) when you're relying on URL-based filtering - instead, let Power BI's filter context do the job.

    Try using below DAX:

    Team_Vol =
    CALCULATE(
        COUNTROWS(tbl_incidents),
        REMOVEFILTERS(tbl_incidents),  -- Optional: removes other filters if needed
        tbl_incidents[Close_datecode],
        tbl_incidents[managerid]
    )
    Individual_Vol =
    CALCULATE(
        COUNTROWS(tbl_incidents),
        REMOVEFILTERS(tbl_incidents),
        tbl_incidents[Close_datecode],
        tbl_incidents[userid]
    )

    The key here is to not use SELECTEDVALUE or variables.Power BI already applies filters via the URL context, and CALCULATE picks them up directly.

    URL Filter Format:

    https://app.powerbi.com/....?filter=tbl_incidents/Close_datecode eq 202501 and tbl_incidents/managerid eq 'WXYZ' and tbl_incidents/userid eq 'ABCD'

    Use no quotes for numeric fields (like Close_datecode).

     Use single quotes for string fields (managerid, userid).

     

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

    Thank you.