cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Anonymous
Not applicable

## Need help - DIVIDE with if statement in Denominator

Hi all,

Im looking for a solution to my problem. I want to do some divide with two statements in denominator like:

DIVIDE
(COUNTROWS('Invoices),
IF('Invoices'[Team] = "A",9,10)

Is it possiable to crate that kind of measure? I know that it isnt possiable to add reference to the column in denominator if statement....

1 ACCEPTED SOLUTION
Super User

Hey @Anonymous ,

do you use it as a calculated column or as a measure?

As you wrote it the first post it looked like a calulcated column. Then my formula should work. If you use it as a measure, you have to add an aggregation. Then the following should work:

``````MyMeasure =
DIVIDE(
COUNTROWS( 'Invoices' ),
IF(
MAX( 'Invoices'[Team] ) = "A",
9,
10
)
)``````

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

6 REPLIES 6
Anonymous
Not applicable

The formula dosent work. Can it be due to the fact that my refference column (Team) is a Custom made column with formula inside?

Super User

Hey @Anonymous ,

yes, that's absolutely possible.

The following approach should work:

``````MyMeasure =
DIVIDE(
COUNTROWS( 'Invoices' ),
IF(
'Invoices'[Team] = "A",
9,
10
)
)``````

You could also put it in a variable if you want to, but here that is not necessary:

``````MyMeasure =
VAR vIfValue =
IF(
'Invoices'[Team] = "A",
9,
10
)
RETURN
DIVIDE(
COUNTROWS( 'Invoices' ),
vIfValue
)``````

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Anonymous
Not applicable

The formula dosent work. Can it be due to the fact that my refference column (Team) is a Custom made column with formula inside?

Anonymous
Not applicable

@selimovd do you maybe know, why it is not working? I cant do reference to a column in this part of your code:

```   IF(
'Invoices'[Team] = "A",
9,
10```

I can make after IF(... reference to another formula or measure....

Super User

Hey @Anonymous ,

do you use it as a calculated column or as a measure?

As you wrote it the first post it looked like a calulcated column. Then my formula should work. If you use it as a measure, you have to add an aggregation. Then the following should work:

``````MyMeasure =
DIVIDE(
COUNTROWS( 'Invoices' ),
IF(
MAX( 'Invoices'[Team] ) = "A",
9,
10
)
)``````

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Anonymous
Not applicable

Thanks! It works!

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors