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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
CoderV9
New Member

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 Manager ID.

The relevant fields in the table are:

  • number (ServiceNow incident number)

  • userid (assigned user ID)

  • managerid (assigned user’s manager ID)

  • Close_datecode (numeric field in YYMM format representing the incident's closure date)

There are no defined relationships in the data model.

The report functions as expected in Power BI Desktop and Power BI Service. However, when filters are passed via a Web URL or from within PowerApps, the DAX calculation does not behave as intended.

Below, I’ve included a sample of the DAX measure and the URL being used to call the report from PowerApps or via the Web.

Team_Vol = 
VAR SelectedManagerEmail = [varMgrID]
VAR SelectedDate = [varDate]
RETURN
    CALCULATE(
        COUNTROWS(tbl_incidents),
        ALLSELECTED(tbl_incidents),
        tbl_incidents[Close_datecode] = SelectedDate ,
        tbl_incidents[managerid] = SelectedManagerEmail
    )
----------------------------------------------------------------
Individual_Vol = 
VAR SelectedUserEmail = [varUsrID]
VAR SelectedDate = [varDate]
RETURN
    CALCULATE(
        COUNTROWS(tbl_incidents),
        ALLSELECTED(tbl_incidents),
        tbl_incidents[Close_datecode] = SelectedDate ,
        tbl_incidents[userid] = SelectedUserEmail
    )
----------------------------------------------------------------
varDate = SELECTEDVALUE(tbl_incidents[Close_datecode])
----------------------------------------------------------------
varMgrID = SELECTEDVALUE(tbl_incidents[managerid])
----------------------------------------------------------------
varUsrID = SELECTEDVALUE(tbl_incidents[userid])


Ideally a URL filtering like https://powerbirul&filter=tbl_incidents/varUsrID eq 'ABCD' and tbl_incidents/varMgrID eq 'WXYZ' and tbl_incidents/varDate eq 202501 should show the total incidents handled by the particular user and by the team under the specified manager for the specified month. Any Hints how this can be done ?

 

1 ACCEPTED SOLUTION
v-venuppu
Community Support
Community Support

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.

 

 

 

View solution in original post

5 REPLIES 5
v-venuppu
Community Support
Community Support

Hi @CoderV9 ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

v-venuppu
Community Support
Community Support

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.

 

 

 

Thank you @v-venuppu I was able to get this fixed with the info you provided. Additonally found that when a PowerBI tile is embedded to PowerApps it cant accept more than one filter parameters. So had to create a custom column with concatenated values and then used a web filter 🙂

Thank you for your support on this..

v-venuppu
Community Support
Community Support

Hi @CoderV9 ,

Thank you for reaching out to Microsoft Fabric Community.

Here are some steps to follow to solve the issue:

To ensure consistent behavior across different platforms, especially when using URL filters or embedding in PowerApps, it's advisable to avoid relying on SELECTEDVALUE for capturing filter values. Instead, restructure your DAX measures to directly utilize the filter context provided by the URL parameters.

Please try using below DAX:

Team_Vol =
CALCULATE(
COUNTROWS(tbl_incidents),
FILTER(
tbl_incidents,
tbl_incidents[Close_datecode] = 202501 &&
tbl_incidents[managerid] = "WXYZ"
)
)

Individual_Vol =
CALCULATE(
COUNTROWS(tbl_incidents),
FILTER(
tbl_incidents,
tbl_incidents[Close_datecode] = 202501 &&
tbl_incidents[userid] = "ABCD"
)
)

In these measures:

Replace 202501 with the desired Close_datecode.

Replace "WXYZ" with the specific managerid.

Replace "ABCD" with the specific userid.

URL Filter Syntax:

When constructing the URL to pass filters, use the following format:

?filter=tbl_incidents/Close_datecode eq 202501 and tbl_incidents/managerid eq 'WXYZ' and tbl_incidents/userid eq 'ABCD'

Ensure that:

String values are enclosed in single quotes.

Numeric values are not enclosed in quotes.

By structuring your measures and URL filters in this manner, you create a direct and reliable linkage between the filters applied via the URL and the data evaluated in your DAX measures, leading to consistent and expected results across different platforms.

 

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.

HI @v-venuppu Thanky you for the guidance.  How do i then pass the filters from URL to the DAX ?

Eg here : tbl_incidents[Close_datecode] = 202501 && tbl_incidents[managerid] = "WXYZ"

the values 202501 and WXYZ should be passed via the URL. 


Directly assigning the values from URL to DAX didnt work either.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.