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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
BachFel
Helper II
Helper II

if statement prob

Hi, the following formula should calculate the sum of LN(ArbeitszeitInH) if Produkt_Nr=2006.301 and so on..

 

Ampel301. = IF(KontElemente[Produkt_Nr]=2006301;CALCULATE(SUM('LN'[ArbeitszeitInH]));CALCULATE(SUM('LN'[Summe_Arbeits&Reisezeit])))

 

The Produkt-Nr ist formatted as text. It won´t work, but I´ve no clue why..

 

Cheers,

Felix

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @BachFel,

 

If the Produkt-Nr is formatted as text you need to change your formula to:

 

Ampel301. =
IF (
    KontElemente[Produkt_Nr] = "2006.301";
    CALCULATE ( SUM ( 'LN'[ArbeitszeitInH] ) );
    CALCULATE ( SUM ( 'LN'[Summe_Arbeits&Reisezeit] ) )
)

If you don't place the ampersand it will be recognized as number since your column is a text the result will not be as you need.

 

Regards

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @BachFel,

 

If the Produkt-Nr is formatted as text you need to change your formula to:

 

Ampel301. =
IF (
    KontElemente[Produkt_Nr] = "2006.301";
    CALCULATE ( SUM ( 'LN'[ArbeitszeitInH] ) );
    CALCULATE ( SUM ( 'LN'[Summe_Arbeits&Reisezeit] ) )
)

If you don't place the ampersand it will be recognized as number since your column is a text the result will not be as you need.

 

Regards

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.