Forum Discussion

PascalCL's avatar
PascalCL
Frequent Visitor
4 years ago
Solved

Prob with infinite

Hello everyone I apologize in advance for my Googel English 🙂

 

I have the following problem.

 

Vorschlag CT =
        IF
   (SUM('Sales invoices 2021/2022 (2)'[Quantity]) =0,
        BLANK(),
        (SUM('Sales invoices 2021/2022 (2)'[Quantity]) - ('Item'[Theoretischer Vorrat])) / SUM('Item'[Anz. / Paket])
   )
 
With the measure I get partly the result "infinite".

 Here once the example.

 

How do I get the "infinite that I have a 0 standing there?

 
 
  • Hi there!

    Dividing by 0 will return "infinite" in Power BI using "/". What you should do is use DIVIDE function instead, where you can set an alternate result to return when dividing by zero.

    The measure would look like this:

    Vorschlag CT =
    IF(
    SUM('Sales invoices 2021/2022 (2)'[Quantity]) =0,
           BLANK(),
           DIVIDE( 
    SUM('Sales invoices 2021/2022 (2)'[Quantity]) - 'Item'[Theoretischer Vorrat], 
    SUM('Item'[Anz. / Paket])
    )
    )
    Let me know if that helps!
  • Please mark my previous answer as a solution and then procced to create a new post with your new question. This way we help other users find solutions to their problems more easily.

3 Replies

  • Hi there!

    Dividing by 0 will return "infinite" in Power BI using "/". What you should do is use DIVIDE function instead, where you can set an alternate result to return when dividing by zero.

    The measure would look like this:

    Vorschlag CT =
    IF(
    SUM('Sales invoices 2021/2022 (2)'[Quantity]) =0,
           BLANK(),
           DIVIDE( 
    SUM('Sales invoices 2021/2022 (2)'[Quantity]) - 'Item'[Theoretischer Vorrat], 
    SUM('Item'[Anz. / Paket])
    )
    )
    Let me know if that helps!
    • PascalCL's avatar
      PascalCL
      Frequent Visitor

      Hi Pablo,

       

      yes it works. Perfekt thx.

       

      Maybe you can help me with another problem?

      When I display the total sum of the measure, the result does not fit.

       

      how can i solve this?

      • PabloDeheza's avatar
        PabloDeheza
        Icon for Solution Sage rankSolution Sage

        Please mark my previous answer as a solution and then procced to create a new post with your new question. This way we help other users find solutions to their problems more easily.