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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DarioH
Regular Visitor

Having Issues using Calculate function, seems to be a problem with the PLACEHOLDER

Hi everyone, I am having issues with the function CALCULATE(), the logic seems obvious to me and it looks like it should work, I am not sure what is the problem, if you have any idea please give me a hand.

 

Let me give you more context. I have the column Issue_Report[Issues], and also have other colum that makes reference to the model year of the vehicle named Issue_Report[MY], this column contains either singles values such as "2021", "2022" or grouped values "2022; 2023", I have added manually another column that contains only the single values of the years named MODEL_YEAR_SELECTOR[MY_Selector] and I put this in a filter.

 

I need to create a measure that filter the Issues where the selected value in the MY_Selector (filter) is contained in the MY. The first thing I did was create a measure that indicates with 1 or 0 if the MY_Selector is contained in the MY:

 

Contains_MY =
IF(CONTAINSSTRING(SELECTEDVALUE(Issue_Report[MY]), SELECTEDVALUE(MODEL_YEAR_SELECTOR[MY_Selector])) = TRUE(), 1, 0)
 
This one works fine as it shows 1 when the MY matches the MY_selector, then I am using the function CALCULATE this way: 
 
Issue by MY_ =
CALCULATE(
    VALUES(Issue_Report[Issue]),
    Issue_Report[Contains_MY] = 1
)
 
I am getting the next error message: A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
3 REPLIES 3
DarioH
Regular Visitor

DarioH_1-1702332593478.png

Hi Corey, first thing, thanks for your support. Please see the image attached. On left side you can see the result I am trying to get, that table shows [Issues], [MY] and the measure [Contains], with an specific filter (on that visual) that only displays values where Contains = 1.  You can see that I have selected MY= 2019 on the filter [MY_Sel]

 

In the table on the right side I added the measure you suggested [Issue by MY_] and the MY, the error message says: "A table of multiple values was supplied, where a single value was expected" I tried with and without the ALL(). Do you know what can be causing this error?

 

DarioH_2-1702333161445.png

 

Could you share more information about what the end goal is?

 

The issue is in using Values as it can return a table (with multiple values) when you add it to the visual it expects a single value. but if your end goal is to say count the number of issues by model year like this:

Corey_M_0-1702480199215.png

The measure works fine by just switching to countrows to get a single numeric value.

edit: to clarify I guess I am confused on how you expect the table on the right should differ from the table on the left when working.

Corey_M
Resolver II
Resolver II

I don't think measures (Contains_MY) can be used that way as a filter. have you tried implementing your measure's logic into a filter function of your calculate measure like so:

Issue by MY_ =
CALCULATE(
    VALUES(Issue_Report[Issue]),
    FILTER(
        ALL(Issue_Report), 
        IF(
            CONTAINSSTRING(
                SELECTEDVALUE(Issue_Report[MY]), 
                SELECTEDVALUE(MODEL_YEAR_SELECTOR[MY_Selector])
            ) = TRUE(), 1, 0
        ) = 1
    )
)

 careful with the all, i'm not quite sure if there's filter context in your issue_report table that you needed.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.