Forum Discussion

LABrowne's avatar
LABrowne
Helper II
2 years ago
Solved

DAX: PLACEHOLDER ERROR

Hi there,

 

I have the below code:

 

No. of Orders =
CALCULATE (
    COUNTROWS(Orders),
    NOT(CONTAINSSTRING(Orders[OrderId], "Cancel")),
    NOT(CONTAINSSTRING(Orders[OrderId], "Under Review")),
    FILTER(VALUES(Orders[OrderId], [OrderFil (%)] >= 1))).
 
Any help would be great thanks very much.
  • hi, LABrowne 

     

    try below

    CALCULATE (
        COUNTROWS(Orders),
        NOT(CONTAINSSTRING(Orders[OrderId], "Cancel")),
        NOT(CONTAINSSTRING(Orders[OrderId], "Under Review")),
        FILTER(
           VALUES(Orders[OrderId]),
          [OrderFil (%)] >= 1
        )
      )

4 Replies

  • Dangar332's avatar
    Dangar332
    Resident Rockstar

    hi, LABrowne 

     

    try below

    CALCULATE (
        COUNTROWS(Orders),
        NOT(CONTAINSSTRING(Orders[OrderId], "Cancel")),
        NOT(CONTAINSSTRING(Orders[OrderId], "Under Review")),
        FILTER(
           VALUES(Orders[OrderId]),
          [OrderFil (%)] >= 1
        )
      )
  • 123abc's avatar
    123abc
    Community Champion

    Assuming that you want to count the number of orders where the order ID does not contain "Cancel" or "Under Review" and the corresponding order fill percentage is greater than or equal to 1%, you can use the following modified code:

     

    No. of Orders =
    CALCULATE (
    COUNTROWS(Orders),
    NOT(CONTAINSSTRING(Orders[OrderId], "Cancel")),
    NOT(CONTAINSSTRING(Orders[OrderId], "Under Review")),
    Orders[OrderFil (%)] >= 1
    )

     

    In this modified code, I removed the unnecessary FILTER function and simplified the conditions within the CALCULATE function. The conditions for "Cancel" and "Under Review" are applied using the NOT(CONTAINSSTRING(...)) functions, and the condition for the order fill percentage is applied directly.

    Make sure to replace "Orders" and "OrderId" with your actual table and column names if they are different in your dataset.

     

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

     

    In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

    • LABrowne's avatar
      LABrowne
      Helper II

      Hi there,

       

      Sorry I am still getting the error I should have mentioned that [OrderFil (%)] is a measure.

       

      Kind regards,

      Luke