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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
SelflearningBi
Helper III
Helper III

How to do percentage correctly.

SelflearningBi_0-1659971223412.png

SelflearningBi_1-1659971275831.png

Im using this dax function, I would like to also display the "NO" otif quanitty % correctly. Now only show the Yes % is correctly. Please help and thanks so much. 

 

2 REPLIES 2
MFelix
Super User
Super User

Hi @SelflearningBi ,

 

In this case your issue is with the context of the calculation, since you are using the column OTIF has a context on the matrix visualization the CALCULATE function is making use of the ALL statement that way you are always getting the YES on your formula try to change the first part of the divide you will get the correct result try to replace your formula by:

OTIF Quantity % =
VAR sumofconfirmedqty =
    CALCULATE (
        SUM ( 'FW22 Order Database'[shipped Quantity(Total)] ),
        'FW22 Order Database'[OTIF] = "YES"
            || 'FW22 Order Database'[OTIF] = "NO"
    )
RETURN
    DIVIDE (
        SUM ( 'FW22 Order Database'[shipped Quantity(Total)] ),
        sumofconfirmedqty
    )

 

This should give expected result.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



 

trial_OTIF Quantity % = 
VAR sumofconfirmedqty = CALCULATE ( SUM ( 'FW22 Order Database'[shipped Quantity(Total)] ), 'FW22 Order Database'[OTIF] = "YES" || 'FW22 Order Database'[OTIF] = "NO" ) 
RETURN DIVIDE ( CALCULATE('A-measure'[Sum Shipped Qty],'FW22 Order Database'[OTIF]="yes"), sumofconfirmedqty )​

 

Hi, thanks for helping. I am using this formula but still only get the same result, and also I put the IN FULL column in the table. The table only displays YES. do you have any suggestution for that? 

this is the new column I created 

 

In Full = 
SWITCH(TRUE(),
    ISBLANK('FW22 Order Database'[Shipped Qty Difference]),BLANK(),
IF(AND('FW22 Order Database'[Shipped Qty Difference]>=0,'FW22 Order Database'[Shipped Qty Difference]<=0.02),"Yes","No"))

 

 @MFelix 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.