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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
hm67yyz
Frequent Visitor

division of 2 measures returns zero

Hi,

I desperately need advices and help, thank you very much!

I have 2 measures with good values -- -- -- 
  * then need measure 1 to subtract measure 2
  * then this subtract result be divided by measure 1

but not matter how (tried long time for days), it returns 0 (zero)

 

(Please see attached pic and file)Pic to Ben.JPG

Below are my DAX measures (showing no errors in my PBI desktop) I have applied:

Below are all my DAX formular, no error shows me:

 

VolumeCompletionRate =

VAR StringA =

Calculate(

COUNTROWS('2FY PR'),

'2FY PR'[Creation Date] >= 2022-04-01 &&

'2FY PR'[Creation Date] <= 2023-03-31 &&

'2FY PR'[PR Type] = "New PR")

 

VAR StringB =

Calculate(

COUNTROWS('2FY PR'),

'2FY PR'[Creation Date] >= 2022-04-01 &&

'2FY PR'[Creation Date] <= 2023-03-31 &&

'2FY PR'[PR Type] = "PR Amendment")

 

VAR StringC =

Calculate(

COUNTROWS('2FY PR'),

'2FY PR'[Creation Date] >= 2022-04-01 &&

'2FY PR'[Creation Date] <= 2023-03-31 &&

'2FY PR'[PR Type] =

"New PR"

|| '2FY PR'[PR Type] =

"PR Amendment")

 

RETURN

[Percentage] = DIVIDE(StringA + StringB), StringC, 0 )

 

 

***********************************************

 

Outstanding # =

CALCULATE(

COUNTROWS('2FY PR'),

    KEEPFILTERS('2FY PR'[Requisition Status]

    IN{"In review", "Validate Business Line Processing", "Workload Manager Processing"}))

 

Outstanding&NonOutstanding # =

CALCULATE(

COUNTROWS('2FY PR'),

    KEEPFILTERS('2FY PR'[Requisition Status]

    IN{"Approved", "In review", "Validate Business Line Processing", "Workload Manager Processing"}))

 

For % #

%Completion# = Calculate(

DIVIDE([Outstanding&NonOutstanding #]-[Outstanding #],[Outstanding&NonOutstanding #]))

 

*******************

Outstanding $ =

SUMX(

    FILTER(

          '2FY PR',

          NOT(ISBLANK(

        '2FY PR'[Requisition Status])) ||

        '2FY PR'[Requisition Status] <> "In review" ||

'2FY PR'[Requisition Status] <>"Validate Business Line Processing" ||

        '2FY PR'[Requisition Status]<> "Workload Manager Processing"),

          '2FY PR'[Filtered Req Amount (Absolute Value)])

 

Outstanding&NonOutstanding $ =

SUMX(

    FILTER(

    '2FY PR',

    NOT(ISBLANK(

    '2FY PR'[Requisition Status])) &&

'2FY PR'[Requisition Status] <> "Approved" &&

        '2FY PR'[Requisition Status] <> "In review" &&

'2FY PR'[Requisition Status] <>"Validate Business Line Processing" &&

        '2FY PR'[Requisition Status] <> "Workload Manager Processing"),

          '2FY PR'[Filtered Req Amount (Absolute Value)])

 

 

For % $

%Completion$ = Calculate(

    DIVIDE([Outstanding&NonOutstanding $]-[Outstanding $],[Outstanding&NonOutstanding $]))

1 REPLY 1
lbendlin
Super User
Super User

generally you cannot measure a measure.  Re-implement the desired business logic completely inside one measure.

 

Some of yours can be refactored for better performance.  Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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