Using calculation groups to selectively replace measures in DAX expressions

Ғылым және технология

Use calculation groups to dynamically replace only a partial expression in a complex DAX calculation. Article and download: sql.bi/673677?aff=yt

Пікірлер: 35

  • @drivetrainerYT
    @drivetrainerYT Жыл бұрын

    Can’t stop thanking for your videos and blog. Awesome.

  • @BernatAgulloRosello
    @BernatAgulloRosello3 жыл бұрын

    Beyond awesome! I can't believe I missed this video when you published it

  • @robertbarkovicz800
    @robertbarkovicz8003 жыл бұрын

    As always, very interesting! Thank you! I would have created a measure which applys the selection of the price to use and then rewrite all the measures to use this. But for your solution such a change is not necessary, as you said: injection. Very elegant! That's the way to go.

  • @Bharath_PBI
    @Bharath_PBI3 жыл бұрын

    Great! Another use case of treatas, this time from disconnected table to calculation group.. I think this would be great, even if we have multiple calculation groups. Thank you 👍

  • @PeterKontogeorgis
    @PeterKontogeorgis3 жыл бұрын

    Wow...that’s some next level stuff!

  • @felipehoerbe4001
    @felipehoerbe40013 жыл бұрын

    Great content! That's really useful and nice for the end user

  • @2404Pepe
    @2404Pepe2 жыл бұрын

    Great video as usual. The problem I find with CG is that I can't choose to remove blanks in the matrix. It doesn't promp me to because it really has only one measure. CG are ok but very limited. Thanks again for this and all your videos!

  • @danielpinzon9284
    @danielpinzon92843 жыл бұрын

    Thank you, Alberto!!! I'm beginning to use calculation groups and this helps me a lot. I have a question, a month ago you gave an interview to Lars Schreiber SSBI-Podcast. You discussed 2 top features. Calculation groups and "DQ over AS" ... which feature is that? If by DQ you mean DirectQuery, what does AS stand for? Thanks a lot and keep the great work you are doing with Marco!

  • @SQLBI

    @SQLBI

    3 жыл бұрын

    AS is Analysis Services, it is the "official name" of the new composite models we shown in this video: kzread.info/dash/bejne/mWGitNp9hteZhNI.html

  • @noahhadro8213
    @noahhadro82133 жыл бұрын

    So good. thank you

  • @cifufull
    @cifufull3 жыл бұрын

    Great Work

  • @SayuriValente
    @SayuriValente3 жыл бұрын

    Perfect!

  • @Tobelerone77
    @Tobelerone778 ай бұрын

    Hi Alberto, thank you for all of your content. Been extremely useful in getting me up to scratch with DAX. My question is what is stopping you from nesting another IF function within the Unit Price calculation item. I seem to get the same result and am wondering if I'm missing something. Code for my Unit Price calculation item below: VAR SalesAmountUnit = SUMX(Sales, Sales[Quantity]* Sales[Unit Price]) RETURN IF ( ISSELECTEDMEASURE ( [Sales Amount]), SalesAmountUnit, IF ( ISSELECTEDMEASURE ( [Margin %]), DIVIDE(SalesAmountUnit - [Total Cost], SalesAmountUnit, 0) , SELECTEDMEASURE() ))

  • @timgray7859
    @timgray78592 жыл бұрын

    Alberto, great video as always. I was hoping that you might shed some insight into another application of calculation groups I'm trying: I have a matrix visual that leadership wants 30+ different measures on and it is a little slow to render, and most business users only need a few of these columns. My thought was to create a calculation group that uses the measure names ( instead of SELECTEDMEASURE() ) and create a slicer to select which columns to display. It worked as expected but the problem is that I can no longer click the headers for sorting and conditional formatting is giving me problems. Have you dealt with this before and/or have any idea where to start with both these issues?

  • @SQLBI

    @SQLBI

    2 жыл бұрын

    Unfortunately there are not workarounds to that yet - you lose features by removing the measures from the matrix.

  • @timgray7859

    @timgray7859

    2 жыл бұрын

    @@SQLBI I was able to figure out a work around for the sorting. I created a disconnected table that just points to the calculation group table, so its the same, and made a measure that switches on the SELECTEDVALUE and returns the associated measure. I used this as the base measure used in the visual (which gives me the option of sorting by this measure), while the calculation group overwrites to the desired measures for the columns. I used a drop down filter named "Sort by" and listed the options. Works great, though not as nice as just clicking the matrix column headers. I don't know if there is anything for the conditional formatting portion of it though.

  • @edavidzh

    @edavidzh

    2 жыл бұрын

    @@timgray7859 @SQBI thank you. @Tim Gray I want to use CG for Dynamics measures in matrix visual as well. I wonder if you could elaborate on disconnected table that points to calculation group. do you by chance have your datamodel/measure screenshot? BTW do you have a problem when users select only one of 30 measures? if they do it in my report PBI redefine all the measures on (even not related to CG) the page to the selected one from CG.

  • @user-bd6wy8zs6e
    @user-bd6wy8zs6e2 жыл бұрын

    Good day mr.Alberto. Thank you very much for your videos. My question is: is it possible ti do a same thing but instead of slicer use a visiual? I explain, for example I have two bar charts with calculated measures and one table. I want that table to replace a certian column value according to what visual is currently selected (clicked) by user. I mean user clicks certain month in the bar chart. Thank you in advance!!!

  • @papachoudhary5482
    @papachoudhary54823 жыл бұрын

    Thanks

  • @Pooja-pd1ee
    @Pooja-pd1ee2 жыл бұрын

    Is there a way to group unconnected measures and select them through slicer? Calculation group doesn't seem to work in this case.

  • @questionsformedb8157
    @questionsformedb81573 жыл бұрын

    super!

  • @xx8pxx
    @xx8pxx3 жыл бұрын

    Is there a way to still use tooltips? Or do calculation groups break that feature?

  • @SQLBI

    @SQLBI

    3 жыл бұрын

    Calculation groups are applied to all the measures, including those used in calculation groups. Depending on your requirements this might work or not work well.

  • @xx8pxx

    @xx8pxx

    3 жыл бұрын

    @@SQLBI I appreciate the reply. That’s what I was thinking :/ But I did try using report page tooltips. For example, I’d have a chart using orders and the calculation group for YoY % Delta. On the report page tooltip I’d “hardcore” YoY Delta (Actual #) to a card visual. This seems to work, but the format string either would apply or not apply based on the month I was hovering over. The number was right, but it’s not very useful if it can’t be formatted. Strange behavior :/

  • @raulvera705
    @raulvera7053 жыл бұрын

    Hello Alberto, and thanks for the video. In our table, PriceToUse, why in important the Column ordinal? thank you in advanced

  • @SQLBI

    @SQLBI

    3 жыл бұрын

    It is there to control the sort order of the names. It is not mandatory, if you remove it you keep the alphabetical order.

  • @eversonjunior8494
    @eversonjunior8494 Жыл бұрын

    Must I use tabular editor to create calculation groups? I ask because I use power bi desktop rs and it does not have the external tools menu.

  • @SQLBI

    @SQLBI

    Жыл бұрын

    The external tool menu appears once you install at least one external tool, such as DAX Studio or Tabular Editor.

  • @RediatBekele
    @RediatBekele3 жыл бұрын

    How can I use the calculation groups in excel data model?

  • @SQLBI

    @SQLBI

    3 жыл бұрын

    You cannot create calculation groups in Power Pivot data models, but you can publish a data model in Power BI and use it with Analzye in Excel.

  • @josemorocho9710
    @josemorocho97102 жыл бұрын

    However with this solution I cannot keep the format string I included in the calculation gruop due to you are not working with the calculation group anymore!!

  • @SuddenlySubtle
    @SuddenlySubtle3 жыл бұрын

    Thank you! Very powerful, indeed. Enjoy DAX lol.

  • @user-lt9bn4nu2h
    @user-lt9bn4nu2h Жыл бұрын

    Why can't use switch???

  • @SQLBI

    @SQLBI

    Жыл бұрын

    You can do more sophisticated calculations with calculation groups and you can change the format string (something you cannot do with SWITCH). Other than that, if SWITCH is written with all the optimizations, then you don't have to change it. See: www.sqlbi.com/articles/understanding-the-optimization-of-switch/

Келесі