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
Anonymous
Not applicable

Divide 2 columns based on a common value

I want to perform the following division from columns in two separate tables:

Failure Ratio=

DIVIDE(
    COUNTA('Failure Table'[Distinct Install to First Failure]),
    COUNTA('All Devices By Region'[Install Year])
)
But only divide where 'All Devices By Region'[Install Year]=YEAR('Failure Table'[Install Day].
How can I modify the measure above to achieve this?
1 ACCEPTED SOLUTION

@Anonymous 
Please try

Failure Ratio =
VAR CurrentYear =
    SELECTEDVALUE ( 'All Devices By Region'[Install Year] )
RETURN
    DIVIDE (
        CALCULATE (
            COUNTA ( 'Failure Table'[Distinct Install to First Failure] ),
            YEAR ( 'Failure Table'[Install Day] ) = CurrentYear
        ),
        COUNTA ( 'All Devices By Region'[Install Year] )
    )

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @Anonymous 
In which table are creating this column? What is the relationship between the two tables? Or are you trying to create a measure? If so how does your report look like?

Anonymous
Not applicable

Hi @tamerj1 ,

I am trying to create this as a measure in the 'Failure Table' table. The two tables are not linked. Currently I have a graph with value of Failure Ratio and axis of Year('Failure Table'[Install Day]). However, currently the data is showing the Count of Distinct Install to First Failure for a given year divided by the total number devices installed, not number of devices installed that year.

@Anonymous 
Please try

Failure Ratio =
VAR CurrentYear =
    SELECTEDVALUE ( 'All Devices By Region'[Install Year] )
RETURN
    DIVIDE (
        CALCULATE (
            COUNTA ( 'Failure Table'[Distinct Install to First Failure] ),
            YEAR ( 'Failure Table'[Install Day] ) = CurrentYear
        ),
        COUNTA ( 'All Devices By Region'[Install Year] )
    )
Anonymous
Not applicable

That worked, thank you!

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.