Measure Grand total is wrong

Hi, 
I found it is wrong for grand total of measure / calculated field? Here is my sample and data: 
Here is the data:
TotalForecast:=CALCULATE(SUM([Qty]), Table1[Data Type]="Forecast")
TotalSales:=CALCULATE(SUM([Qty]), Table1[Data Type]="Sales")
Diff:=[TotalSales]-[TotalForecast]
ActualDemand:=if([Diff]<0,[TotalForecast],[TotalSales])
Is there something wrong for my expression?
Thanks
Wilson

The "problem" is that measures actually calculate individually for each cell in a pivot.  What that means is that technically the grand total row in a pivot is not related to the rows above it.  Intuitively, it seems like it is related
because often times the grand total is what you expect.  This can be a little confusing at first but there are some blog posts out there that do a good job of explaining the concept.
Your current measure is looking at the Diff only as it pertains to the grand total row.  It sees 9 and therefore returns the value of TotalSales.
The quickest fix is probably just to add one more measure that forces your current measure to evaluate itself in the proper context:
ActualDemand2:=
SUMX(
VALUES(Table1[Product Type]),
[ActualDemand]
In PowerPivot functions that end in "x" are called iterators.  They let you change the granularity of a calculation by cycling thru the individual rows of a table you specify.
In this case, the table I am using is VALUES(Table1[Product Type]), which is a single column table containing the unique values of the Product Type.
Now your measure evaluates the sum for each Product Type (which ends up being the 4 results showing in your pivot table above for each Product) and adds those 4 results together for Grand Total.

Similar Messages

  • Grand total showing wrong results

    Hello,
    I am having one prblem,using obiee 11g.
    Have a pivot table with 3 columns, one is month and other are showing numbers.
    For month we show the 2 number columns
    when i click grand total its showing the wrong total for the second number column.
    I really don't understand why its happening?
    Any help?
    Thanks

    Hi,
    Set Aggregation Rule as Server Complex Aggregate may solve your problem, ie goto
    Column -> Edit Formula -> Aggregation Rule -> Server Complex Aggregate
    Thanks,
    Balaa...

  • Wrong Grand Total in 11g

    Please list out the solutions available to solve the Grand total issue.
    These are the problems Im facing.
    If I enable Grand total I find some rows missing in the report.
    sometimes if i apply any calculations in report(fx) grand total is wrong and again some rows missing.
    These same issues I faced in BISE1 and it is still continuing.
    Any solutions?

    Hi sneha,
    sometimes if i apply any calculations in report(fx) grand total is wrong and again some rows missing.Strange behaviour of missing rows,dint come across this......tell us the exact problem
    These same issues I faced in BISE1 and it is still continuing.How did you solve this issue in BISE1.
    By,
    KK

  • Grand Total in Dimension Hierarchy

    Hello,
    I still have problem to get the correct Grand total. The Dimension "Project" goes down to Level 4  (some projects only to Level 3). First I solved summing up a calculated measure  with Isleaf() or SUM (currentmember.children).
    Then the grand total always summed up all members and not those which where filtered in Excel. Here i found the current solution with VisualTotals().  But now i still the problem that when expanding sublevels in excel the Grand total is wrong
    again:
    CREATE MEMBER CURRENTCUBE.[Measures].[Prognosekosten] AS
    CASE
    WHEN IsLeaf([Projekt].[Projekt Hierarchie].currentmember)
    THEN ...calculation....
    WHEN [Projekt].[Projekt Hierarchie].currentmember is [Projekt].[Projekt Hierarchie].[ALL]
    THEN sum(except(  VisualTotals(axis(0)), [Projekt].[Projekt Hierarchie].[All]), [Measures].[Prognosekosten])
    ELSE Sum([Projekt].[Projekt Hierarchie].currentmember.children, [Measures].[Prognosekosten])
    END

    Hi Wolfgang,
    According to your description, you create calculated member to calculate the grand total, now the problem is that the grand total is incorrect when you filter the data in Microsoft Excel, right? In this case, please refer to the links below which might helpful
    for you.
    http://wildwordz.wordpress.com/2008/11/21/not-so-grand-totals-in-ssas-cubes/
    http://vnu10.blogspot.com/2011/01/mdx-grand-total-sub-total.html
    Regards,
    Charlie Liao
    TechNet Community Support

  • Total of grand total in pivot

    Hello Guys,
    I have a situation...
    I am using Pivot View for a report (the reason being...I need the data by month in sections....)...
    I need total for each section so I used the Sum button of Rows for grand total of each section (again the reason being....if I used Sum of Sections...it will display another section as 'All sections' which is nothing but all the entries clubbed into one table.....which is not desirable in my case)..
    So, I almost have what I want..the only thing I would require is the Grand total of all the Grand totals at the bottom....
    Can anyone help me please.....I tried many ways...but couldn't get it.....

    Thanks friend....I got it...
    only problem I faced while fixing this was...The grand total formatting...I had to customize it as I didnt find a way to hide the measure grand total...
    what I mean is....after hiding the details,etc...I was left with only one row..which is the calculated column 'Grand Total',....but it was just as any other row...(i.e.,) without any formatting...default background and font...
    but when I clicked on 'Sum' for the 'Row'.....it showed me the actual Grand Total which means ...with formatting...but then....there were 2 rows now.....so I removed the 'Sum' and manually did the formatting to match with the other Grand Totals.....this was a workaround....let me know if there is any better solution...
    Thanks anyways for the solution....

  • Grand total for user

    Hello,
    Using obiee 11g,
    I am trying to build a report where i am trying do a count(distinct un),so i created a logical column for that and using that in my answers.
    The un i am showing for over months.IS works fine except that the grand total shows wrong.
    Grand total just adds the months total and not just do a count distinct for un.
    Aggregation rule is set as default.
    Would like to know how to do this?
    Thanks

    Hello,
    Its not working that way.
    Let me explain my case in detail.Problem is only in case of GRAND TOTAl.
    I am showing different cases,users and export for each month.
    So cases and users are used everywhere so i created a logical column in the RPD.
    count(distinct caseid) and count(distinct userid) as cid and uid and using that in my answers.
    export count since not used everywhere initially i took that column into my answers and then did a count(xportcount) in my answers
    so i have now
    cid-uid-count(xportcount) as 3 columns in my answers.But here the problem is my Grand total for uid comes wrong.
    Instead of doing a distinct users for all the months selected it just shows the grand total as sum for users
    Like jan-16 users feb -17 users then the total is 16+17 and not the distinct users from jan and feb.
    Grand total for case and exportcount is correct because i need a sum in that case so aggregation rule as deault works fine here.
    Here the problem which i feel is the count distinct which i am doing for caseid and uid and not exportcount.
    In my second scenario i did like created a separted column count(exportcount) in the rpd, then used that in my answers.
    But still no use
    In my third sceanario i created a count(distinct exportcount) in the rpd and using that in my answers
    now it feels it works fine.
    I wnat to know is this the way BI works.
    I am bit confused now.
    Is there a way other then this to do.
    I wanted first,second sceanario also to work but doesnt feel like working is there a way to make it work?
    Thanks

  • Grand Totals are incorrect

    I have two facts : Income & Forecast
    I have two dimensions : Date & Organisation
    I have a report for 2007 that shows the following data:
    Week Income Forecast
    Week1 100 100
    Week2 100 100
    Week3 100 100
    Week4 100 100
    Week5 100 100
    GTotal 10000 10000
    I know that the grand total is wrong as I have NOT selected the report based total, so it is totaling for all years, not the year that I have filtered for.
    When I change to report based totals I get:
    Week Income Forecast
    Week1 100 0
    Week2 100 0
    Week3 100 0
    Week4 100 0
    Week5 100 0
    GTotal 500 0
    The foreign keys and joins for income and forecast are the same.
    Any ideas ?
    Ross

    Your forecast values rollup properly if you do not have the grand total? Add another criteria which would basically do the summation of the forecast and the amount values(add filters depending on what you have in the first criteria). Combine it with the first criteria using union all. Check whether this produces your output properly(if the grand total gets interspersed with the data, add some logic to make it appear at the place you want). This will help us understand where it is going wrong.
    Thanks,
    Venkat
    http://oraclebizint.wordpress.com

  • How to set Grand Total of a Measure when its aggregation rule is Max in Logical Layer

    Hi
    I have a Measure Column (Budget) and in Logical layer the aggregation rule is set as (Max) which looks like Max(Budget). But now it is included in the report and when my client is trying to see its grand total, it is giving the Max Budget figure of the report rather than giving the total sum(grand total).
    Kindly share some ideas in achieving the grand total without disturbing the actual aggregation of the measure.

    Thank You for your reply.
    In my case i don't have a problem with aggregation for Budget Measure(max(Fact_XXKC_SHIP_TO_BUDGET_CAT_F.SALESREP_BUDGET_YTD)). This is the aggregation rule applied on the Salesrep Budget YTD.
    Now i created a report with columns
    Salesrepresntative(Dimension),, Sales Invoices(Measure1),, SALESREP_BUDGET_YTD(Measure 2).
    In the above report the values are perfect, but when we used Grand total option at ROW level in table view, the grand total of Measure1 is cumulative of all the rows, but the Grand total of SALESREP_BUDGET_YTD (measure2) is the max of all the columns.
    What i require is the Grand total of SALESREP_BUDGET_YTD (measure 2) should be cumulative of all the columns.
    I have shared my SQL query, kindly verify it and share any idea.
    select sum(case when T97600.W_XACT_TYPE_CODE = 'Chargeback' then T93664.NET_AMT * T93664.GLOBAL1_EXCHANGE_RATE end ) as c1,
      sum(case when T97600.W_XACT_TYPE_CODE = 'Credit Memo' then T93664.NET_AMT * T93664.GLOBAL1_EXCHANGE_RATE end ) as c2,
      sum(case when T97600.W_XACT_TYPE_CODE = 'Debit Memo' then T93664.NET_AMT * T93664.GLOBAL1_EXCHANGE_RATE end ) as c3,
      sum(case when T97600.W_XACT_TYPE_CODE = 'Standard Invoice' then T93664.NET_AMT * T93664.GLOBAL1_EXCHANGE_RATE when T97600.W_XACT_TYPE_CODE = 'Invoice Cancellation' then T93664.NET_AMT * -1 * T93664.GLOBAL1_EXCHANGE_RATE end ) as c4,
      T315597.XXKC_RESOURCE_NAME as c5
      from
      W_CUSTOMER_LOC_USE_D T315597 /* Dim_W_CUSTOMER_LOC_USE_D_Status */ ,
      W_SALES_INVOICE_LINE_F T93664 /* Fact_W_SALES_INVOICE_LINE_F */ ,
      W_XACT_TYPE_D T97600 /* Dim_W_XACT_TYPE_D_Sales_Ivclns */
      where ( T93664.XACT_TYPE_WID = T97600.ROW_WID and T93664.DELETE_FLG = 'N' and T93664.XX_SHIP_TO_LOC_USE_WID = T315597.ROW_WID )
      group by T315597.XXKC_RESOURCE_NAME
      ) D1 full outer join (select max(T313184.SALESREP_BUDGET_YTD) as c1,
      T315597.XXKC_RESOURCE_NAME as c2
      from
      W_CUSTOMER_LOC_USE_D T315597 /* Dim_W_CUSTOMER_LOC_USE_D_Status */ ,
      XXKC_SHIP_TO_BUDGET_CAT_F T313184 /* Fact_XXKC_SHIP_TO_BUDGET_CAT_F */
      where ( T313184.SITE_USE_WID = T315597.ROW_WID )
      group by T315597.XXKC_RESOURCE_NAME

  • Wrong SSAS Grand Total Value Monthly Value base on Weekly Value

    Dear All, 
    I Have calculated measures in my cube base on Weekly and Base on Monthly and different
    Template Base .
    For grand Total Weekly is fine but for Monthly is bad one.
    Say calculated Measure Name "Weekly" with Syntax
    CREATE MEMBER CURRENTCUBE.[Measures].[Weekly]
     AS IIF(isempty([Measures].[Actual Quantity MTD]) or [Measures].[Actual Quantity MTD]=0 or isempty([Measures].[Original Plan Quantity  MTD])   , null ,
    IIF([Measures].[Original Plan Quantity MTD] =0 or isempty([Measures].[Original Plan Quantity MTD]),null,   
    IIF( 
     ([Measures].[Actual Quantity MTD]-[Measures].[Original Plan Quantity MTD]) > 0 , 1 ,[Measures].[Actual Quantity MTD]/ [Measures].[Original Plan Quantity MTD] ))) 
    The Result is good
    here the picture
    http://hpics.li/9fd22f2
    https://drive.google.com/open?id=0ByY5H-XcydgiWGp0RzdWYWp0M2c&authuser=0
    and for Monthly Calculation  it was AVG of Weekly base on Time, Plant, and PSL Dimension 
    My calculated Monthly Measure Name "Monthly" with Syntax
    CREATE MEMBER CURRENTCUBE.[Measures].[Monthly]
     AS AVG ( 
    DESCENDANTS([PSL].[PSL Description])*
    DESCENDANTS([Plant].[Plant])*
    DESCENDANTS([Finish Date].[Calendar],[Finish Date].[Calendar].[Month Year]) 
    , AVG(([Finish Date].[Calendar].CURRENTMEMBER.CHILDREN), [Measures].[Weekly]))
    The Result is Bad on Grand total 
    here the Picture link 
    http://hpics.li/5233b50
    https://drive.google.com/open?id=0ByY5H-XcydgicEhtT1FpekRsbW8&authuser=0
    Please help me why for the Result doesn't same. What do i Miss
    Thank You 
    Yan

    Hi Yan,
    According to your description, you create a calculated measure in your cube, the problem is that grand Total for Monthly is incorrect, right?
    In your scenario, the issue can be caused by that you used "*" and "/" in your calculated measure. In SSAS, one of the most common issues faced in mdx is grand total or sub total not coming properly when some arithmetic operations like
    measure1 [* or + or - or /] measure2 is used, please refer to the link below to see the details.
    http://vnu10.blogspot.jp/2011/01/mdx-grand-total-sub-total.html
    Regards,

  • How to hide % measure column Grand Total  value in Pivot View in obiee 11g?

    Hi ,
    I am facing a issue in obiee 11g .I am using a Pivot table to display the grand total of 3 metric columns eg: A , B,  C out of which B is percentage  so I need to remove the grand total value of the percentage column. We have to stick to Pivot View only. Anyone can sugest me on this?
    Thanks ,
    Shruti

    Move B to rows section or cast to char in Criteria tab by keeping the B in Measures section only.
    cast(B as char)

  • Grand total of 2 measures in pivot table

    Hi,
    I have a requirement to show in a pivot table in which there are 2 measures - Male_count and Female_count. In the column I have Age_group such as 20-30,30-40 etc. In the row I have grade like assistant, manager etc. The requirement is to show column subtotals - total male count & total female count as well the total no. of employees (F+M) across all age groups. Using the column total I get only the sub total part. How can i get the total part?
    Look forward to your inputs.
    Regards,
    J

    Grade
    25 and under
    26-40
    40-55
    55 and above
    Subtotal
    Grand total
    F
    M
    F
    M
    F
    M
    F
    M
    F
    M
    Manager
    0
    1
    1
    1
    2
    2
    3
    4
    7
    8
    14
    Assistant
    0
    1
    1
    1
    2
    2
    3
    4
    7
    8
    14
    Developer
    0
    1
    1
    1
    2
    2
    3
    4
    7
    8
    14
    Using OBIEE pivot features I am able to obtain upto the Subtotal but I am not getting the Grand total.
    Hope this pivot gives an idea of what I am trying to implement.
    Thank you.

  • Measures and Grand Total

    Hello,
    I have a power pivot table as follows (note that OwnSquareFeet is a measure = SquareFeet * OwnPercent):
    Identifier    Address                  SquareFeet   OwnPercent  OwnSquareFeet
        a1          123 Somewhere            50               
    100%             50
        a2          456 Anywhere               80                 
    40%             32
    Grand Total                                   130               140%            182
    Is it possible to:
    - suppress the Grand Total for OwnPercent
    - have the Grand Total for the OwnSquareFeet be the sum of the OwnSquareFeet column as opposed to the Grand Total of the SquareFeet * Grand Total of the OwnPercent (130 * 140%)
    - In certain cases I may want the Grand Total of the OwnPercent to be Grand Total of OwnSquareFeet/ Grand Total of SquareFeet
    In a previous question which was similar in some aspects, I received an answer that included the isfiltered function.  I tried using this with limited success.
    Thanks for any help
    ihorwitz

    Would you please provide more detail on your data model? A copy of the workbook on OneDrive or similar would be most helpful, followed by screenshots/text copied, or a detailed description.
    Further, we cannot suggest a solution if you do not provide the full details of your requirements. What are the certain cases that determine when Grand Total of OwnPercent should be [OwnSquareFeet] / [SquareFeet]
    What are the solutions you have tried and where are you hitting issues?
    Please peruse this link to ask better questions that can get you answers faster.

  • SAP query in Grand Totalling in SQ01 wrongly calculation

    Dear All,
    I have created a  SAP query for getting few ledger accounts data in the clients specified format.
    But I am having a problem, that debit and credit amounts are getting added in the 'Total' field.
    The credit amounts are not getting substracted from the debit amount.
    For eg :
    CoCd     G/L          Year     DocumentNo      Amount in LC     Crcy     D/C
    1000     4071101020          2007     9600000002     3,300.00          H
    1000     4071101021          2007     9600001413     40,000.00          S
    1000     4071101022          2007     8000000000     2,020,012.80     H     
    Grand Total                                                                2,063,312.80     
    Where as total should be -1,983,312.80, where 'H' is credit and 'S' is debit.
    rgds

    Hiya,
    You may need to:
    1. Either group by the Debit/Credit Indicator (SHKZG), create two subtotals for each and then subtract one from the other, or,
    2. Multiply the Credits by -1 (again use the Debit / Credit Indicator to sort this for you) and then get a total field.
    This is an inbuilt problem with queries (SQ01, SQVI, etc.).
    Cheers.

  • Wrong Grand total

    In our database we 've data for a lot of departments. The department number is in almost every table part of the key. Each department has shops
    In the login initialization block we decide which department we want to see information of.
    When I make a small request eg. shop, turnover, I see all the shops from the department initialized in the ini. block.
    But, when we want to make a grand total (in the same request) by pressing the summation sign on top, this grand total is the sum of all shops of all departments together. (not the only one department which is selected in the initalization block)
    Is this a BUG?

    Could you add dept =(dept from init block) in the fact table LTS content tab and see?

  • Grand total values are not matching with Detail report

    Report has grand totals and when I drill to the detail report, grand total values are NOT matching with parent report totals, I did some analysis but I'm clueless on this issue.
    Please provide your thoughts and insight on this issue..
    Thanks

    is your summary and detail reports hitting different facts, like summary hitting aggregate and detail report hitting it's corresponding detail level fact..?
    if then,
    From Front-end:
    Fix the filter values in detail report that are passing from master report then try delete each columns then check the grand total. If you found your values is matching by deleting particular column then you need to investigate what is the issue around with that dimension table..
    From Database side:
    1. check first aggregate table has proper aggregate data of it's detail..
    2. Take the detail report obiee generated query and try to comment each dimension table and it's corresponding joins to the facts, (before, this delete all the dimensional columns and other measures from select statement and put only that measure where you are getting wrong value, so that you need not to comment all the select and group by columns which saves your time.. ). Need to check by commenting each dimensional wid and it's table from clause, if you found that values is matching then there is some problem with wid columns data population in your ETL.
    Is that BI-Apps project?
    btw, whtz ur name?

Maybe you are looking for