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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
spencer_II
Helper I
Helper I

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.

1 ACCEPTED SOLUTION

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

View solution in original post

6 REPLIES 6
Fowmy
Super User
Super User

@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

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.

 

 

@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

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Case % Lift = If(sum(Tbl_BPPromoSumry[Uplift - With (m1052)])<1,"No Uplift",
DIVIDE(sum(Tbl_BPPromoSumry[Uplift - With (m1052)]),sum(Tbl_BPPromoSumry[Base Shipments (m4120)]),0))

 

Expected result:

spencer_II_0-1604237426017.png

Returned result:

 

spencer_II_3-1604237522114.png

 

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

Hi @spencer_II ,

Glad to hear the issue is solved. You can accept your reply as solution, that way, other community members could easily find the answer when they get same issues.

Best Regards,
Community Support Team _ Yingjie Li

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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