Context Transition in CALCULATE and Clarification of Correct Terminology

Dear Team,
Question #1:
If I create a Calculated Column with this aggregate calculation:
SUM-Aggregate =SUM(PlayersTable[Salary])
Is this a correct statement:
“Aggregate functions are affected by Filter Context, but will ignore Row Context and will show the same aggregated number in every row of the Calculated Column.”
Question #2:
If I create a Calculated Column with this aggregate calculation inside the CALCULATE function:
SUM-Aggregate-in-CALCULATE =CALCULATE(SUM(PlayersTable[Salary]))
Are these correct statements (these are my interpretations of Alberto Ferrari’s & Marco Russo’s book MS Excel 2013 Building Data Models with PowerPivot):
“An aggregate calculation inside CALCULATE will show just the row values not the aggregate values, and so if there is no relationship on this table, the Calculated Column will simply show the individual amounts for each row from the Salary column.”
“Inside CALCULATE, there is no Row Context”
“If you use only the first argument in CALCULATE, it will transform Row Context to Filter Context.”
Question #3:
If the three statements are TRUE from question #2, how do I make sense of them given that as a person new to PowerPivot I “see” CALCULATE returning individual row amount and thus think that CALCULATE is doing a Row Context”
Question #4:
If I create a Calculated Field:
TotalSalary:=SUM(PlayersTable[Salary])
And then create this Calculated Column:
SUM-CalculatedField-Auto-Call-To-CALCULATE =[TotalSalary]
Is this a correct statement:
“The Calculated Field comes with an automatic CALCULATE function wrapped around it and so because it is in a Calculated Column it will show just the row values and not the aggregated value”.
Sincerely, Mike "Struggling To Learn PowerPivot" Girvin

First, a minor thing, but I'm Greg. Michael Amadi proposed my original response as an answer to the thread, but hasn't participated otherwise in the thread.
I don't know how familiar you are with SQL, but I'll try explaining with that.
TotalAmountCC =SUM(fSales[amount]) is roughly equivalent to the following being evaluated:
SELECT
f1.*
,TotalAmountCC = (SELECT
         SUM(f2.amount)
        FROM fSales f2
FROM fSales f1
Wrapping your measure in CALCULATE() changes the filter context for evaluation. 
TotalAmountCC2 =CALCULATE(SUM(fSales[amount])) is roughly equivalent to the following
SQL:
SELECT
f1.*
,totalcc2 = (SELECT
SUM(f2.amount)
FROM fSales f2
WHERE f2.date = f1.date AND
f2.[sales rep] = f1.[sales rep] AND
f2.product = f1.product AND
f2.amount = f1.amount
FROM fSales f1
What CALCULATE() is doing is looking at every field in the row, and then it is finding every row that matches on all fields. When you introduce a primary key, it is a logical impossibility for any two rows to have matching values for every field. Power Pivot
does not in this case understand that a primary key exists, it is simply looking for rows where the field which happens to be called [PrimaryKey] is equal to the value of that field on the current row.
For a more concrete example, I will look at what is happening on the first and second rows of each table for each formula.
TotalAmountCC
Row 1: Just take the sum of all values in the field [amount]
Row 2: Just take the sum of all values in the field [amount]
TotalAmountCC2
Row 1: Create a filter context that will only consider rows where [date] = 9/3/2014 AND [sales rep] = 'joe' AND [product] = 'p1' AND [amount] = 22. Evaluating the table with respect to this filter context gives us two rows, row 1 and row 4. We then
sum the field [amount] for these rows
Row 2: Create a filter context that will only consider rows where [date] = 9/4/2014 AND [sales rep] = 'sindy' AND [product] = 'p2' AND [amount] = 15. Evaluating the table with respect to this filter context gives us only one row, row 2. Thus we
evaluate the sum of the field [amount] for this one row. Doing so returns the value since adding 15 and nothing is 15
TotalAmountCC3
This is exactly the same as above.
TotalAmountCC4
Row 1: Create a filter context that will only consider rows where [PrimaryKey] = 1 AND[date] = 9/3/2014 AND [sales rep] = 'joe' AND [product] = 'p1' AND [amount] = 22. Evaluating the table with respect to this filter context gives us only one
row, row 1, because row 4 does not match on [PrimaryKey], even though it matches on all other fields. Thus, we evaluate the sum of the field [amount] for this one row, giving us 22, the value on that row.
Row 2: Create a filter context that will only consider rows where [PrimaryKey] = 2 [date] = 9/4/2014 AND [sales rep] = 'sindy' AND [product] = 'p2' AND [amount] = 15. Evaluating the table with respect to this filter context gives us only one
row, row 2. Thus we evaluate the sum of the field [amount] for this one row. Doing so returns the value since adding 15 and nothing is 15.
It is important to note that it doesn't matter that the field you added is a primary key, or that it is named [PrimaryKey]. You could have added time of day, and so long as the values are different for each row, you'd see the same behavior. Setting the table
property of the field as a primary key will not change the behavior of CALCULATE() in this situation. The only thing CALCULATE() is doing is evaluating the function (SUM() in our case) for every row where every single field is equal to the values of that field
for the current row.

Similar Messages

  • Why Levels mid-point slider and Exposure Gamma Correction slider not the same?

    Both the mid-point slider in Levels and the Gamma Correction slider in Exposure adjustment appear to modify Gamma.  They even use the same numeric scale.
    When Gamma <= 1, both sliders appear to produce the same results (confirmed with a couple of random sample settings and using the Difference blend mode).
    When Gamma > 1, however, the results are very different.  Levels produces more what one would expect in terms of moving the Gamma curve without moving the white and black points but the Exposure Gamma Correction slider seems to do something very different, either moving the black point or applying a very different curve the produces much brighter tones in the dark shadows.
    Can anyone explain why and how these two adjustments produce different results?
    Is this a bug with the Exposure adjustment?
    By the way, in my limited tests of this I was just using a standard RGB file in 16-bit mode - nothing fancy like 32-bit or LAB or anything like that.  Also, Photoshop CS6 Extended.  Both 32- and 64-bit versions show the same behavior.
    Thanks.

    The differing gamma adjustment results also occur in the OS X version of Ps 13.0.1
    The situation is worse than you realize, Dennis. Test with a linear grayscale gradient in 16-bit or 8-bit RGB mode instead of arbitrary images. Remember to view at 100% zoom for an accurate display.
    Gamma adjustments of less than 1 performed by Levels adjustment layer and Exposure adjustment layer do differ but to a less obvious extent than when the adjustment is greater than 1. Differences can be seen in histograms, and low level differences when differencing layers can be made more obvious by adding an Exposure adjustment layer with the exposure increased.
    You'll get further different results by using the gamma adjustment in the "Exposure and Gamma" method of Image > Adjustment > HDR Toning. Notice that the gamma value there has to be specified as the inverse of that in Levels and Exposure.
    I haven't bothered to calculate which, if any, of the three gamma adjustment controls gives correct results because that is Adobe's responsibility.
    It's quite ridiculous that a common routine giving consistent and correct results isn't being used for all these gamma adjustments. Code re-use makes software more robust, simpler to test, simpler to correct, leaner and overall easier to manage. But what do I know.

  • Keynote Recorded Slideshow tends to "miss" transitions in playback and upon

    From time to time, I read, in these discussion, some outstandingly derogatory comments about some of the Apple software. Although disappointed at times, I had never felt the level of frustration that seems to lead other users to those outbursts - until now. I've run into a problem that I have been unable to resolve, but according to all documentation, what I am trying to achieve is one of the features designed into the product.
    Keynote seems to have a tendency to "miss" a transition during playback and/or export, such that the recorded audio becomes one transition ahead of the visual component of the presentation. There is no apparent consistency to this, as re-recording may find the "miss" at a different point in the presentation, and exporting it to QuickTime may see the "miss" in another spot altogether.
    In some cases, the "miss" was an "On Click" transition. In other cases, the "miss" was an automatic (after transition/previous transition) transition or move, but always with zero delay. Let me re-phrase this - the transitions occurred correctly during the recording. It is in the playback or export of the recorded slideshow that the transition is subsequently "missed."
    I moved the work from my dual G5 to my IC2D and re-recorded, but resolution was not found.
    One might suggest the imbedding of audio in each slide, however, a really good show includes audio that "bridges" slides to improve the continuity of the presentation (or movie, which is the ultimate objective for this current project). Recording the audio externally (e.g. Garageband) takes considerable effort to marry the video with the audio in close synchronization.
    I am seeking others who have had the same experience and who have found the elusive solution.

    Just read your post and I appear to be having a similar problem with a trial version of '09. I just posted this on another topic.
    "I'm trying out the '09 Version of Keynote and have made a great slideshow that I want to export to a Quicktime Movie. I have a soundtrack playing in time with transitions through the first portion, then a slide which contains a quicktime movie. Then a further 2 slides with one containing a short sound effect.
    I've done this before on '08 so I'm sure I'm not doing anything wrong, but everytime I export to a movie the movie within the slideshow doesn't play.
    I've recorded the slideshow to get all the timings in time with the music, I've tried setting ALL transitions to automatic and fined tuned them to match the music. Then recorded it and kept quiet.
    This slideshow will play from start to finish with no input from me, but when I export it, the movie in the slideshow just remains on the first frame till the next transition happens.
    I've even tried uploading straight to YouTube but the same occurs.
    Help, is it a glitch in the software. I've had 3 movies playing within a slide before and successfully exported it in a movie in '08. What's wrong!!!
    Cheers for any feedback"
    Chris

  • I have an wireless printer and a new wifi router. I have set the printer and iPhone / iPad correctly to the new router but when i try to print it won't recognise the air printer. Help. All was working fine on my old router

    I Have a new wifi router and have set up my iPad / iPhone and wireless printer correctly  to the new router but I can't print from the iPad and iPhone. It keeps saying ' no AirPrint printer found'. Help please!

    Start with the most basic thing that you can try. Unplug the router from power for about 30 seconds, and restart the printer and the iPad and plug the router back into power.

  • HT201272 I have purchased 3 books from Itunes - for my Ipod.  The books show up as purchased on the PC but not on the Ipod. The other books i have purchased and have downloaded correctly have a square beside them when shown on the PC. I have checked my au

    i have purchased 3 books from Itunes for my ipod. The books show up on the PC as purchased but do not show up on the Ipod anywhere.  Other books i have bought and have downloaded correctly have a square symbol beside them - but the three books in question do not. I purchaed 4 tonight and only one has worked. There is plently of room on the Ipod as the books are only 7 and ten mins long.  I want my money back - or the books to download.

    i have purchased 3 books from Itunes for my ipod. The books show up on the PC as purchased but do not show up on the Ipod anywhere.  Other books i have bought and have downloaded correctly have a square symbol beside them - but the three books in question do not. I purchaed 4 tonight and only one has worked. There is plently of room on the Ipod as the books are only 7 and ten mins long.  I want my money back - or the books to download.

  • I have one paid mobileme account, few days ago I have done transition to iCloud and all my iDisk, contact... gone. Today I tried login to iCloud application on my windows pc but can not, it said "this apple id is valid but is not iCloud account"

    I have one paid mobileme account, few days ago I have done transition to iCloud and all my iDisk, contact... gone. Today I tried login to iCloud application on my windows pc (64bit) but I can not, it said "this apple id is valid but is not iCloud account". I can login on website icloud.com but can not login into iCloud application installed on pc. What's wrong?
    I have tried another free apple ID and logged on. That's funny when I can login with free account and can not login with paid mobileme account!!!!!!

    By the way - the only reason I downloaded iCloud is because Apple deleted the backup option from iTunes.  Since iCloud doesn't work, I guess we have no way to protect our iTunes music collection.  Absolutely stupid.

  • The report server has encountered a configuration error. Logon failed for the unattended execution account. (rsServerConfigurationError) Log on failed. Ensure the user name and password are correct. (rsLogonFailed) Logon failure: unknown user name or bad

    The report server has encountered a configuration error. Logon failed for the unattended execution account. (rsServerConfigurationError)
    Log on failed. Ensure the user name and password are correct. (rsLogonFailed)
    Logon failure: unknown user name or bad password 
    am using Windows integrated security,version of my sql server 2008R2
    I have go throgh the different articuls, they have given different answers,
    So any one give me the  exact soluction for this problem,
    Using service account then i will get the soluction or what?
    pls help me out it is urgent based.
    Regards
    Thanks!

    Hi Ychinnari,
    I have tested on my local environment and can reproduce the issue, as
    Vaishu00547 mentioned that the issue can be caused by the Execution Account you have configured in the Reporting Services Configuration Manager is not correct, Please update the Username and Password and restart the reporting services.
    Please also find more details information about when to use the execution account, if possible,please also not specify this account:
    This account is used under special circumstances when other sources of credentials are not available:
    When the report server connects to a data source that does not require credentials. Examples of data sources that might not require credentials include XML documents and some client-side database applications.
    When the report server connects to another server to retrieve external image files or other resources that are referenced in a report.
    Execution Account (SSRS Native Mode)
    If you still have any problem, please feel free to ask.
    Regards
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Mac won't open some files MasterPlan.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

    I had this problem of not being able to open some files a couple of years ago and eventually was able to fix it but i can't remember how. Any help would be grateful.

    The following document should help: Error: Adobe Reader could not open '*.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and was not correctly decoded.)
    Please update this thread if your issue is resolved.
    Thanks,
    Shashi

  • Trying to restore after getting a new hard drive.  I can see the backup on the Time Capsule and on the correct date but it is Greyed out.  That is it wont let me open it and restore the machine.  Have tried also Migration Assistant, no luck.

    Trying to restore after getting a new hard drive.  I can see the backup on the Time Capsule and on the correct date but it is Greyed out.  That is it wont let me open it and restore the machine.  Have tried also Migration Assistant, no luck.

    https://discussions.apple.com/thread/5210788?tstart=0
    At startup hold down the Command+Option/Alt+r keys until you see a globe on the screen. Then use disk utility to partition and format the drive HSF+ and then select Reinstall Mac OS X. whatever version of OS X that originally came on your system will be installed and then you can upgrade back to Mavericks.

  • My family put multiple devices on the icloud, and I need to know how to manage duplicate entries.  Specifically contacts.  If I fix the contact list on my pc will it push the info out to the other devices and maintain it correctly?

    My family put multiple devices on the icloud, and I need to know how to manage duplicate entries.  Specifically contacts.  If I fix the contact list on my pc will it push the info out to the other devices and maintain it correctly?

    All devices signed into the same iCloud account will finish up with the same contacts. Of course if prior to joining iCloud two family members each had an entry for Uncle Fred, then you will finish up with two contact cards for Uncle Fred, and so on. If you tidy this up on your computer then the changes will propagate to everyone else.

  • After the latest update, all my apple products reverted to an old icloud account.  As it no longer exists, I cannot get into it to delete it and add the correct id.  How can I change this, especially on my Macbook pro?

    After the latest update, all my apple products reverted to an old icloud account.  As it no longer exists, I cannot get into it to delete it and add the correct id.  How can I change this, especially on my Macbook pro?  There is no p/w related to it and even though I tried to reset "password" it won't allow as the id does not exist, neither does the email associated with the old id.  How do I switch it to a newer id?

    It's all rather odd because the old account cannot 'no longer exist' - if you don't have the correct password you won't be able to get into it, but you can't actually delete an iCloud account from the server.
    I'm afraid you will need the services of iCloud Support. If you currently happen to have AppleCare, either because you recently bought Apple hardware or have paid to extend the inititial period, you can contact them here:
    http://www.apple.com/support/icloud/contact/
    You will need the serial number of the covered hardware.
    If you are not covered by AppleCare, then - in common with other free email services - there is no free support and you may be asked to pay a fee.

  • My iPod touch is not connecting to iCloud account, under iCloud settings has old email account and username that I have since updated and are working correctly on my iPad, any idea how I can reset this?

    My iPod touch is not connecting to my iCloud account, under iCloud settings it  has my old email account and username that I have since updated and are working correctly on my iPad, any idea how I can reset this on the iPod or otherwise? This old account info keeps coming back on my iPod and messing up access to my apple account and now the icloud. last time a system restore needed to be done to fix it....

    It won't give me the option to sign out of the old account, it's that light grey color that you can't click on. And since it has the old email address that it's telling me to go into to verify the account, I can't actually change it... I'm stuck

  • TS3297 when I press the iTunes button on my ipod touch I get the message 'cannot connect to iTunes store' .  My wifi is working fine, I can connect to safari & you tube, no parental setting in place, and time and date are correct. Can anyone help please?

    When I press the iTunes button on my ipod touch I get the message 'cannot connect to iTunes store' .  My wifi is working fine, I can connect to safari & you tube, no parental setting in place, and time and date are correct. Can anyone help please? I have restored my ipod to factory settings and rest it.

    I also tried moving the date forward by a year and then moving it back to normal and it still doesn't work.  i can't find an automatic update of time zones on my itouch to turn this off.

  • We have two Airprint capable printers thagt my wife uses with her Samsung Galaxy s4 but both printers are NOT listed on my iPhone 4s. any ideas why and how to correct??

    I have two printers ... Cannon MS5400 and an Epson Workforce 840 ... both are Airprint capable as my wife prints to both via her Samsung Galaxy S4.
    My iPhone 4S only has the Cannon listed when I go to print. Any deas as to what is going on and how to correct???

    There are a lot of posts in the forums today with people having problems with iMessage.   There was also a published outage yesterday, so it's possible there are still some issues that may be impacting you both.
    I would just wait it out - I'm sure it will be sorted out soon.

  • I would like to see and access the correct sound patches from my E-mu mps orchestral plus from inside of logic express.

    I would like to see and access the correct sound patches from my E-mu mps orchestral plus from inside of logic express.
    Right now , I have access to some of the sound files but most are missing and all are incorrectly labeled.
    Is it possible to ("Library") these sound files or access them from logic?
    Thanks
    J

    HI,
    I'm not quite sure who you think you are addressing here with your idea but this is a user to user forum. Apple don't come here.
    If you want to offer ideas or feedback to Apple, it would be best for you to do it here:
    http://www.apple.com/feedback/logic-pro.html

Maybe you are looking for

  • I Photo not down loading from camera

    For some reason my I Mac is not down loading pictures from my camera, or SD Reader or CD / DVD to the library. It will start to down load and you see the pictures loading, then IPhoto crashes ( at 25th or 157 picture) saying operation stopped for unk

  • Photoshop trial version does not run on macbook pro operations system

    hi, i've alreasy made an update of my macbook pro, but the trial version of photoshop is still not running "on this operation system". anyone?

  • CPU/GPU fans question

    Hi everyone, i own a MSI GS70 2PE and i wonder is there any kind of fans that i can buy that has lower DBI or w.e it's called fan noise level? since when i etc go into bios fans are loud and when i do os install fan becomes loud but goes lower and is

  • MOVED: How to switch to external graphic card

    This topic has been moved to MSI Notebooks & Netbooks. https://forum-en.msi.com/index.php?topic=172971.0

  • W520 - Windows Server 2008R2 and color sensor

    Good evening, Does anybody have an experience how to make calibration working under Windows Server 2008 R2? It beeps 3 times when I close the lid and displays the message that system cannot be put to calibration mode. Thank you! Solved! Go to Solutio