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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
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....
 
Thanks in advance!



1 ACCEPTED SOLUTION

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
 

View solution in original post

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?

murban_0-1632219990162.png

 

selimovd
Super User
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....

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!

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.