Forum Discussion

spencer_II's avatar
spencer_II
Helper I
5 years ago
Solved

If then statement returns all values

Attempting to use an if, then statement so that IF a column has a certain value then calcuated result will either return a "%" or text value that indicates "No number"

eg. If(sum(uplift cases)<1, "No Uplift", Divide( uplift cases,base cases,0))

The Dax measure returns the expected value if uplift is less than one the table column reads "No Uplift" and is uplift is 1 or higher it returns the % calculation from the Divide function.

ISSUE: when I filter customer (Using slicer) for a specific account the table returns ALL customers and not just slicer selection. I've tried wrapping in Calculate ALL SELECTED, SELECTED VALUE and also using VAR's.  All patterns return expected result but all variations still return all Customers vs. just selected.  Always appreciate the assistance.

  • spencer_II's avatar
    spencer_II
    5 years ago

    Thanks for reviewing post... I think I found a solution.  I put the If/then as a calculated column and then used that column in my table.

    Now when customer is selected in slicer it only shows that customers.

     

    Thanks, Spencer_II

6 Replies

  • spencer_II 

    What is the relationship defined in the model?

    Does your measure return Text and % ??. 

    ________________________

    If my answer was helpful, please consider Accept it as the solution to help the other members find it

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube  LinkedIn

    • spencer_II's avatar
      spencer_II
      Helper I

      Thanks for responding///

      Yes measure will return both Text and % value.  The issue is when I filter the customer ALL customers show in table vs. just selected.

      Customer from data table has a many to 1 relationship with Customers table and is SINGLE on cross filter direction.

       

       

      • Fowmy's avatar
        Fowmy
        Super User

        spencer_II 

        Not clear enough, 

        Can you share a sample PBIX file show me the expected behavior?

        ________________________

        If my answer was helpful, please consider Accept it as the solution to help the other members find it

        Click on the Thumbs-Up icon if you like this reply 🙂

        YouTube  LinkedIn