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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
pimgo
New Member

If Statement wrong column total (with greater than)

Dear all,

 

I have been searching for the correct solution the whole day, but unfortunately I have not found it yet. When incerting the following DAX code as new measure I get the incorrect colomn total: 

 

 

    IF(
        [Gasketel kWh]>0,
        SUMX(VasteWaarden,[dT]),
        0)

 

 

[Gasketel kWh] is a calculated measure. 

 

I get the measure/column total of VasteWaarden[dT].I have also tried the hasonefilter code, but it does not seem to work (no values): 

 

 

Gasketel draaiuren = IF(HASONEFILTER('VasteWaarden'[dT]),
IF([Gasketel kWh]>0,SUM(VasteWaarden[dT]),0),
SUMX(FILTER('VasteWaarden',[Gasketel kWh]<0),0))

 

 

 

Does anyone know what I should do differently? Many thanks if anyone knows what to do..! 

Regards, Pim

1 ACCEPTED SOLUTION

Hi, @pimgo 

Thank you for sharing.

Please check the link down below, that I included the fixed version of two measures.

I hope I correctly understood your question.

 

https://www.dropbox.com/s/hzfvlnxo55rc8fj/Uitlegmodel.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

6 REPLIES 6
Jihwan_Kim
Super User
Super User

Hi, @pimgo 

I am not quite sure whether I understood your question correctly, but try the below for newly creating a column.

 

new column = 

IF(
        [Gasketel kWh]>0,
        calculate ( SUM([dT])),
        0)

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: https://www.linkedin.com/in/jihwankim1975/


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Unfortunately when adding a column it doesn't show any values. 

My problem is a followed: When using the if forumla  I get an incorrect colomn total. Question: I want to get the correct sum from all the individual lines. 

Hi, @pimgo 

Thank you for your feedback.

Please try two steps.

 

First measure = your first created measure

 

Second measure = sumx (values(vastewaarden[dt]), [first measure])

 

 

 

 

It is quite difficult for me to tell something without seeing your sample pbix file.

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: https://www.linkedin.com/in/jihwankim1975/

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Dear @Jihwan_Kim ,

 

It  took some time to do it, but here is the link to the pbix file:  [deleted]  I hope this works for you? I inserted the calculatings which are correct. Unfortunately your suggestion does not work. 

 

Hopefully with the example it becomes clear what I mean. 

Hi, @pimgo 

Thank you for sharing.

Please check the link down below, that I included the fixed version of two measures.

I hope I correctly understood your question.

 

https://www.dropbox.com/s/hzfvlnxo55rc8fj/Uitlegmodel.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you very much, I didn't know I had to do something with the 'first ' colomn too. For the people intrested in the solution: 

Gasketel draaiuren fix = 
SUMX (
    SUMMARIZE(
        VasteWaarden,
        VasteWaarden[Uur],
        VasteWaarden[dT],
        "@gasketel draaiuren", IF ( [Gasketel kWh] > 0, SUM ( VasteWaarden[dT] ), 0 )
    ),
    [@gasketel draaiuren]
)

 

I had two columns (in the same table) of which the first one shows the unique values. Thank you @Jihwan_Kim 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors