Computing totals by summing visible values in DAX

Поділитися
Вставка
  • Опубліковано 20 гру 2024

КОМЕНТАРІ •

  • @cesart4257
    @cesart4257 9 місяців тому +2

    An absolute beast. SQLBI is really the best page out there for DAX. The fact this video was made 3 years ago is also insane. Congrats!

  • @ilanapregen1684
    @ilanapregen1684 2 місяці тому +2

    i love you. you have helped me so much, not just with this video, but with countless others, teaching me how to do things I NEVER would have figured out on my own. Seriously, blessings upon blessings onto you.

  • @visheshjjain
    @visheshjjain 4 роки тому +10

    I was struggling for 3 days with this and it took me 2 mins after watching this to get what I needed.
    Thanks!!!

  • @allejulien645
    @allejulien645 2 роки тому +3

    This is probably one of the most usefull tutorial i've ever seen in my entire life, trully

  • @jessamhan
    @jessamhan 4 роки тому +7

    Hi Alberto, in the final expression around the 3:43 mark why is the outer CALCULATE necessary? Both the Sales Amount measure and the COUNTROWS expression are already embedded within one, so the context transition from the SUMX iterator will happen anyway.

    • @SQLBI
      @SQLBI  4 роки тому +3

      True, the outer CALCULATE can be removed in this case. However, the good news is that the outer CALCULATE does not affect performance, it just makes the code more verbose and can be avoided.

  • @misaelpadilla7012
    @misaelpadilla7012 2 роки тому +1

    I wasted a lot of time trying with summarize and then I found this video, just amazing

  • @arturziolkowski1705
    @arturziolkowski1705 Рік тому +1

    You saved me hours of trials. I'm happy that I found this video.

  • @OA-lx2zr
    @OA-lx2zr 2 роки тому +1

    This is a life saver video.... Been having a problem with a particular report for days and this just saved me!!!!!!

  • @oliveroshea5765
    @oliveroshea5765 4 роки тому +2

    Excellent. Thank you Alberto and Marco for posting these videos

  • @mayuranpara4734
    @mayuranpara4734 7 місяців тому +1

    One of the best. Was struggling for couple of days. Thanks a lot.

  • @felipesignorellireis7839
    @felipesignorellireis7839 4 роки тому +4

    That is exactly what i needed . Thanks Alberto.

  • @ericet19
    @ericet19 3 роки тому +4

    Thank you for this, it solved my problem ! It feels like magic when everything adds up properly. Thanks again.

  • @jisuskamilov
    @jisuskamilov Рік тому +1

    Thanks for the video. I wish I could find this video before 3 days of suffering🙂

  • @JonathanCHANAL
    @JonathanCHANAL Рік тому +1

    Hi, I feel like the first CALCULATE is not useful here since the context transition is already there (use measure + other CALCULATE). What do you think of this code: COUNTROWS(FILTER('Date', 'Date'[Working Day]="Workday" && [Sales Amount])). Thanks

  • @sotork
    @sotork 5 місяців тому +1

    Ciao Alberto, huge fan of your work here!...I think the video is repeated in the playlist.

  • @Tastenmann
    @Tastenmann 2 роки тому +1

    Great elegant solution to my current issue 👍
    Love you guys

  • @joaquimcosta952
    @joaquimcosta952 4 роки тому

    I already knew this calculation, but sometimes I like to review some calculations and I always come to the conclusion that many courses are inspired by your material. It is the path to immortality.
    I'm just sorry that the number of "LIKES" doesn't reflect the number of views. It is the least we can do to acknowledge the excellent work that Alberto and Marco have been doing for years and that many people have helped.
    How difficult can it be to make "LIKE" ???

    • @SQLBI
      @SQLBI  4 роки тому

      Thanks!!

  • @thunderingravi
    @thunderingravi 3 роки тому +2

    Thank you so much for the short video... This really helped me to solve my problem

  • @JonatasBeque
    @JonatasBeque 11 місяців тому +1

    You saved my day! Thank you so much!

  • @pedrohca
    @pedrohca Рік тому +1

    This video is life saving! Thank you so much

  • @HennessysXO
    @HennessysXO 3 місяці тому

    What if I want to compute the null values as part of a total , can the measure alternate between both totals when users selects month with values (not null) vs months with values (including null) ?

  • @goldwhispers
    @goldwhispers 2 роки тому

    Do you have other videos similar to this, im stuck on a similar'ish problem. I am trying to average a division at the total level but its not working.

  • @yannickfranckum6589
    @yannickfranckum6589 4 роки тому +1

    Exactly what I was looking for! Thanks for sharing

  • @Dianamort09
    @Dianamort09 10 місяців тому +1

    Thank you! I was able to figure it out because of this explanation 🎉

  • @UweSeidel-d1n
    @UweSeidel-d1n 3 місяці тому +1

    Awesome, thanks for sharing!

  • @lionels839
    @lionels839 Рік тому

    Hello
    Is the standard SUMMARIZE or ADDCOLUMNS + SUMMARIZE technique equivalent?

    • @SQLBI
      @SQLBI  Рік тому

      It's better to use ADDCOLUMNS+SUMMARIZE - see www.sqlbi.com/articles/best-practices-using-summarize-and-addcolumns/

  • @sivamani9752
    @sivamani9752 4 роки тому +1

    Super, it would be helpful if you show how sort the columns based on the grand total in the bottom.
    Eg: left coulum with customer name, top columns are with few sales rep names and in the table it will have each sales reps sales amount for each customer, now i want to sort the sale rep based on the total sales done by each rep( total in the bottom)

  • @lucasgv
    @lucasgv 2 роки тому +1

    Salved my life! Thanks a lot!

  • @poorak3
    @poorak3 5 місяців тому +1

    Great video! Helped me a lot. Thank you!

  • @radicholakov9588
    @radicholakov9588 3 роки тому +1

    Great video! It really helped me out. However I'm struggling to make it work when trying to iterate on more then one column by using summarize columns. Any tips how to make it work as if in the example placing the year and month in separate columns?

    • @SQLBI
      @SQLBI  3 роки тому +2

      You should iterate the combination of the two columns - it requires an extra step, for this reason a single column with year and date is better (and it works also as hidden column, the user can choose two columns).
      The simpler, the better (and also the faster):
      SUMX ( VALUES ( 'Date'[YearMonth] ), )
      SUMX ( SUMMARIZE ( 'Date', 'Date'[Year], 'Date'[Month] ), )

  • @growlife4779
    @growlife4779 7 місяців тому

    Is there a way to do the following
    I created a measure to get proportion of sale per entity divided by the total sales across all entities.
    Then I wanted to create a measure called other that groups all entity sales that are below 3% into one summed up value.
    using alteryx what you can do is just a formula tool that can write new column called comment and get it to comment other in row if below 2% total sales and then just filter out comment other and sum it to get a one value called other.
    I was just trying to figure out how to sum of a measure that is not based on values in a table but also another measure?
    If i can create a calculated column that just pulls in the values when its below 3% I can just sum the column in that table. But as its a measure I cannot use a sum or sumx. I tried to get the measure into a calculated column but it won't let me because the rows have different values and it needs to be one.

  •  4 роки тому +1

    Grazie Maestros!!! Grazie per Tutti !!

  • @itskshitijaa
    @itskshitijaa 2 роки тому +2

    Hello Sir! This was insightful Thankyou! I however am facing an issue if anyone can help. You see, I have one Measure(Hrs Above Base) where I simply calculate difference between two other measures of the same table (Actual). Now, when the result of difference is negative I want to set it to zero. It is doing exactly this But then the Total seems to be incorrect still. I am iterating on the resources here. Am I missing anything here ?

    • @emilyamalkin4367
      @emilyamalkin4367 Рік тому

      Ask your question on Power Bi Community site - you will get an immediate response (or several!)

  • @NikitaShilyaev
    @NikitaShilyaev 8 місяців тому

    but if ever we want to show this table say by weeks, not by months, we should create another measure?

  • @lionels839
    @lionels839 Рік тому

    Hello
    This formula does not work When you want to average visible values

  • @mathew9665
    @mathew9665 4 роки тому

    Nice - if you can have sales value of both positive and negative, I would presume your if condition instead of >0 would isnotblank ?

    • @SQLBI
      @SQLBI  4 роки тому +2

      Yes you can use NOT ISBLANK ( )

  • @atullo1423
    @atullo1423 11 місяців тому +1

    What would the PBI developers be without SQLBI. THANKS A LOOOTT!!!

  • @ExcelandPowerBISinhalen
    @ExcelandPowerBISinhalen 4 роки тому

    How do you zoom in and out in Power BI?

    • @SQLBI
      @SQLBI  4 роки тому +1

      You can use ZoomIt (free) or GlassBrick screen magnifier (licensed). We use both, depending on the context.

    • @ExcelandPowerBISinhalen
      @ExcelandPowerBISinhalen 4 роки тому

      @@SQLBI Amazing Thank you very much.

    • @oliveroshea5765
      @oliveroshea5765 4 роки тому +2

      @@SQLBI more context 😂

    • @DIGITAL_COOKING
      @DIGITAL_COOKING 4 роки тому

      @@SQLBI yeah! , there is context for everything 🙂, great video Alberto you give me an idea about calculation i had in the past

  • @Kmsbi
    @Kmsbi 4 роки тому +1

    Thank you so much for sharing. you are awesome

  • @1yyymmmddd
    @1yyymmmddd 3 місяці тому

    This works with simple data models. Should you have more complex calculations computing data from different tables the issue becomes much more challenging.

  • @aleksanderstrommer7677
    @aleksanderstrommer7677 4 роки тому +3

    I am still waiting the day when I have fun with DAX...

    • @SQLBI
      @SQLBI  4 роки тому +1

      Yes, you could use NOT ISBLANK ( ).

  • @mrgreenteatime
    @mrgreenteatime 3 роки тому +2

    For all those people arriving from excel environment I wish you good luck a lot of petience :)

  • @susantakumar8330
    @susantakumar8330 4 роки тому +1

    Nice 👍

  • @nazmulalam2046
    @nazmulalam2046 4 роки тому +1

    Thanks its helpful

  • @anshulroxx6791
    @anshulroxx6791 2 роки тому +1

    But then your measure will only give the correct subtotals for the field defined in DAX VALUE() {Calendar Year Month}
    If we pull some other columns lets say Department level we will get incorrect totals.
    Whats your take on this?

  • @emmanuelagbo218
    @emmanuelagbo218 11 місяців тому

    Having a date table with the min and max date of the sales table would have prevented this error. Though I learnt something new.

  • @RichArd-ee2qj
    @RichArd-ee2qj 2 роки тому

    Ahhhhhh......
    Why does this work?
    I plagiarized the code.
    It corrected a similar problem I was having.
    Pax LY =
    SUMX (
    VALUES ( '_Calendar'[Date] ),
    CALCULATE (
    IF (
    ISBLANK ( [Pax] ),
    BLANK (),
    CALCULATE ( [Pax], SAMEPERIODLASTYEAR ( _Calendar[Date] ) )
    )
    )
    )

  • @dominikreim7723
    @dominikreim7723 2 роки тому

    Best way is to use a Power Query generated Index column for the Values function

  • @markuzz1982
    @markuzz1982 10 місяців тому +1

    Thanks a lot! Problem solved!