1 Mashing Up Data with PowerPivot* When “Filter, Then Calculate” Does Not Work in DAX Measures This time you need to open the file with the worksheet Sls and have it linked to the PowerPivot window,...

1 answer below »
instructions are in hands-on 5 file


1 Mashing Up Data with PowerPivot* When “Filter, Then Calculate” Does Not Work in DAX Measures This time you need to open the file with the worksheet Sls and have it linked to the PowerPivot window, using Add to Data Model as in the last hands-on assignment. 1. Please create a pivot table first showing the sum of sales by each representative on each date. Now the task is made so easy. However, if you want to compare the sales to the total sales for a month, you need to do some calculation. In DAX, instead of using SUMIFS, you need to use Calculate. Calculate asks for an expression and then one or more filters. For those filters, you are going to use a special function called ALL. ALL says that you want it to look not just at one representative’s sales for a particular date, but all the sales in the table. 2. Suppose you want to see % of Grand Total Sales. You need to create a new measure (Hint: right click on Table1 to select Add Measure) by using =SUM(Sls[Sales])/Calculate(SUM(Sls[Sales]), ALL(Sls)). The pivot table shows that % of Grand Total for Bill’s sales of $851 on June 2, 2011 represents 0.9 percent of the grand total sales. 3. Now you want to calculate how Bill’s $851 sale on June 2 compared to all sales on June 2. The numerator of the DAX measure is =SUM(Sls[Sales]). The denominator is going to be hard. Instead of ALL(Sls), you need to ask for AllExcept(Sls, Sls[Date]). It means go ahead and throw out all the filters except for the Date filter. Keep filtering by date. Please create a new measure, % of Daily Sales, by using the formula 2 =SUM(Sls[Sales])/Calculate(SUM(Sls[Sales]),AllExcept(Sls,Sls[Date])). Bill’s $851 sales is now 25% of the daily sales on June 2, 2011. 4. You can also override the filters by specifying other filters in the Calculate Function. The actual syntax of the Calculate function is Calculate (Expression, [filter 1], [filter 2], [filter 3], ….). Please create a new measure, Amber Sales, to calculate all Amber’s sales. The Calculated Field formula should be =CALCULATE(SUM(Sls[Sales]),Sls[Rep]="Amber"). 5. If Amber is the sales star in the store, perhaps you would want to show everyone’s sales as a percentage of Amber’s Sales. =SUM(Sls[Sales])/Calculate(SUM(Sls[Sales]), Sls[Rep]="Amber") shows sales as a percentage of Amber’s total sales for that day. Please create such a new measure 3 4 Mix in Time Intelligence Functions You can apply many filters in the Calculate function. You can replace the first argument in Calculate with MAX, MIN, AVERAGE, or any function. There are 34 Time Intelligence functions. If you want to calculate a running month to date (MTD) total, you can use the Calculate function and specify a filter of DatesMTD(Sls[Date]). But only for reps that match, use AllExcept(Sls, Sls[Rep]). 1. To show MTD sales for each rep, create a new measure, MTDThisRep, using the formula =Calculate(SUM(Sls[sales]), DatesMTD(Sls[Date]), AllExcept(Sls, Sls[Rep])) 2. You can also use previously defined calculated fields to simplify the calculation for another measure. To get to This Rep’s Percentage of MTD Sales versus all MTD Sales, first, you need to build MTDThisRep (Already exists). Next, you need to build MTDAllRep using Calculate(Sum(Sls[Sales]),DatesMTD(Sls[Date]),All(Sls)). Now you can simply build the formula =Sls[MTDThisRep]/Sls[MTDAllRep] as shown in the Calculated Field Settings image below. Please check a book for a complete list of Time Intelligence Functions 5 3. Save and close your Excel file. Half of your completed data table should look like this: 6 Please make sure that all the data columns are properly formatted, all your created measures are activated (with a check mark in front of each). The Excel 2016 program on my computer is a little wired – Sls is only shown as the data model name, not as the table name in the field list. So far as the linked table name in Power Pivot is Sls, the results should not be affected. Combination Layouts The PivotTable drop-down in the PowerPivot Window offers eight choices: If you plan to convert the pivot table to values to reuse it, choose a flattened pivot table which is only a few clicks along the way. A combination report offers one or more pivot tables or charts. Note that for each chart on your layout, Microsoft inserted a new worksheet to hold the actual pivot table for the chart The following steps show how to replicate the layouts shown in the blogs and press: 7 1. Open the Excel file BlogsAndPress. Link it to PowerPivot Window. (Hint: Please review the section on adding calculated columns using DAX. You have to add two new columns – Month and Year to Table1.) 2. Once you added two columns Month and Year to your linked data table, you need to select Four Chart option from Pivot Table menu in PowerPivot window. 3. Select New Worksheet instead of Existing Worksheet in the dialog box. 4. If it does not work well the first time, choose a location rather than letting them default. Choose a spot on Row 5 of the new worksheet (Sheet1 probably). You can always drag a chart structure to wherever you want on the worksheet later as well. 5. Go back to Power Pivot window and select Four Chart option for Existing Worksheet, but Sheet1 location data should show in the text box. 6. Add as many slicers as possible to the top and left of the chart. 7. Look into the charts image on the next page. Simple bar chart on top of the pie chart shows the values of Year and Month. Since these two variables are on the same level, you need to move them into the same Axis field as shown in the field list. The bars should represent the Count of Source. Feel free to use the cross button to change the chart element and the brush button to change the bar color as you like. 8. The pie chart shows Count of Type values by Source. 9. For Media Type, you need to choose Stacked Area from chart models to use. It is created by selecting Type, Month and Year from the Field list. The formula is Type * Year and Month. Legend of the chart should use Type as well. 10. The last chart uses the Stacked Bar Chart model. Webinar belongs to Type. The 3Rd Party is a Source. Thus, it should be created using Type (on Vertical Axis) by Source (as Values), using Source as legend. You may still need to fine tune each chart to make it look identical to the one in the image. 8 11. Now you are ready to make the data display look better. Make Row 1 very tall, perhaps 270 to 300 points tall. Use Insert, Screenshot to add an interesting graphic to Row 1. 12. Add an interesting graphic below the charts to balance the graphic on top of the charts. 13. Go to file, Options, advanced, Display Options for This Worksheet. Clear the Gridlines check box. If you want to go all out, scroll up and clear the scroll bars, sheet tabs, and formula bars. 14. Minimize the ribbon. 15. Add a fill color behind the whole worksheet. 16. Although the pivot table is active, click on the bounding box around each slicer. Right-click on the border. Select properties. Select Move and /Size with cells. 17. Click away from the pivot table. You’ve reached the end of this long assignment. If you ever changed any data in a table, the changes may not be reflected in the pivot table immediately. However, in the top part of the PowerPivot Field List, you may see a warning message to refresh the relevant pivot table and please do it accordingly. If you see the values shown in a pivot table different from those in a given image, examine the measure(s) used and the relationship between the tables in PowerPivot window. They might be the sources of errors. 9 When you complete this assignment, please save both data files, each using the original file name and your name initials as the new file name (the pattern should be). Submit both files to the relevant assignment submission dropbox in Learn 9. _______________________ *: This assignment is adapted from Chapter 10 in Pivot Table Data Crunching: Microsoft Excel 2010 written by Bill Jelen, Michael Alexander, 2013, Que Publishing, Indianapolis, IN, USA. Sls DateRepSales 6/1/11Bill148 6/1/11Amber107 6/1/11Amber232 6/1/11Amber73 6/1/11Bill136 6/1/11Dale88 6/1/11Chris49 6/1/11Amber134 6/1/11Bill62 6/1/11Amber202 6/1/11Amber299 6/1/11Amber36 6/2/11Dale82 6/2/11Bill107 6/2/11Bill278 6/2/11Bill37 6/2/11Bill134 6/2/11Chris145 6/2/11Eddy190 6/2/11Amber217 6/2/11Eddy250 6/2/11Amber752 6/2/11Dale218 6/2/11Bill32 6/2/11Eddy109 6/2/11Bill66 6/2/11Bill117 6/2/11Eddy122 6/2/11Amber60 6/2/11Amber65 6/2/11Dale59 6/2/11Chris200 6/2/11Bill80 6/2/11Chris84 6/3/11Chris93 6/3/11Amber185 6/3/11Chris218 6/3/11Eddy149 6/3/11Chris54 6/3/11Amber86 6/3/11Chris251 6/3/11Dale62 6/3/11Amber473 6/3/11Bill115 6/3/11Amber99 6/3/11Bill104 6/3/11Amber86 6/3/11Bill34 6/3/11Dale126 6/3/11Bill285 6/3/11Bill149 6/3/11Amber265 6/3/11Bill78 6/3/11Dale48 6/3/11Eddy146 6/3/11Amber114 6/3/11Chris91 6/3/11Amber136 6/3/11Chris321 6/4/11Bill105 6/4/11Amber99 6/4/11Eddy149 6/4/11Amber198 6/4/11Bill41 6/4/11Bill79 6/4/11Chris212 6/4/11Chris217 6/4/11Bill150 6/4/11Chris37 6/4/11Bill25 6/4/11Chris70 6/4/11Bill45 6/4/11Chris62 6/4/11Amber631 6/4/11Bill87 6/4/11Bill127 6/4/11Amber26 6/4/11Chris253 6/5/11Bill225 6/5/11Amber112 6/5/11Dale137 6/5/11Chris72 6/5/11Eddy44 6/5/11Amber44 6/5/11Bill236 6/5/11Chris410 6/5/11Bill66 6/5/11Bill78 6/5/11Chris40 6/5/11Bill267 6/5/11Amber64 6/5/11Bill25 6/5/11Bill123 6/5/11Eddy54 6/5/11Amber142 6/5/11Amber265 6/5/11Amber140 6/5/11Amber61 6/5/11Amber72 6/5/11Bill284 6/5/11Eddy38 6/5/11Chris56 6/6/11Amber77 6/6/11Amber132 6/6/11Dale90 6/6/11Dale63 6/6/11Amber261 6/6/11Eddy290 6/6/11Amber63 6/6/11Chris37 6/6/11Chris96 6/6/11Chris274 6/6/11Bill111 6/6/11Bill247 6/6/11Bill232 6/6/11Bill396 6/6/11Chris26 6/6/11Bill215 6/6/11Eddy57 6/6/11Chris93 6/7/11Chris146 6/7/11Bill225 6/7/11Amber133 6/7/11Chris243 6/7/11Chris37 6/7/11Amber802 6/7/11Bill38 6/7/11Amber63 6/7/11Bill145 6/7/11Dale73 6/7/11Chris132 6/7/11Eddy37 6/7/11Bill288 6/7/11Dale70 6/7/11Bill26 6/7/11Bill254 6/7/11Amber186 6/8/11Chris646 6/8/11Dale28 6/8/11Amber46 6/8/11Amber101 6/8/11Chris66 6/8/11Dale52 6/8/11Amber227 6/8/11Amber949 6/8/11Bill100 6/8/11Amber81 6/8/11Eddy211 6/8/11Eddy130 6/8/11Amber230 6/8/11Bill50 6/8/11Amber198 6/8/11Chris53 6/8/11Eddy36 6/8/11Eddy136 6/8/11Amber186 6/8/11Bill188 6/9/11Bill27 6/9/11Bill31 6/9/11Amber223 6/9/11Eddy37 6/9/11Amber101 6/9/11Bill37 6/9/11Chris39 6/9/11Amber208 6/9/11Amber138 6/9/11Bill116 6/9/11Dale172 6/9/11Bill139 6/9/11Chris160 6/9/11Bill81 6/9/11Amber190 6/9/11Eddy290 6/9/11Bill213 6/9/11Chris44 6/9/11Eddy207 6/9/11Amber25 6/9/11Amber114 6/9/11Bill144 6/9/11Amber39 6/9/11Chris139 6/9/11Dale150 6/9/11Bill70 6/9/11Chris81 6/10/11Amber203 6/10/11Amber68 6/10/11Chris190 6/10/11Bill100 6/10/11Amber80 6/10/11Chris131 6/10/11Amber33 6/10/11Dale59 6/10/11Dale88 6/10/11Amber169 6/10/11Amber94 6/10/11Amber263 6/10/11Eddy238 6/10/11Dale219 6/10/11Amber84 6/10/11Eddy26 6/10/11Dale141 6/10/11Amber50 6/10/11Eddy143 6/10/11Chris115 6/10/11Bill69 6/10/11Bill32 6/10/11Amber61 6/11/11Bill142 6/11/11Amber69 6/11/11Chris216 6/11/11Amber263 6/11/11Bill103 6/11/11Bill85 6/11/11Dale156 6/11/11Amber61 6/11/11Eddy54 6/11/11Amber162 6/11/11Bill570 6/11/11Chris124 6/11/11Amber150 6/11/11Amber122 6/11/11Chris122 6/11/11Amber101 6/11/11Dale212 6/11/11Amber124 6/11/11Bill267 6/11/11Chris26 6/11/11Amber35 6/11/11Bill30 6/11/11Amber209 6/11/11Dale300 6/11/11Chris112 6/11/11Amber297 6/11/11Amber264 6/11/11Chris102 6/11/11Amber275 6/11/11Eddy253 6/11/11Amber258 6/11/11Amber105 6/12/11Eddy191 6/12/11Bill136 6/12/11Amber129 6/12/11Bill185 6/12/11Amber286 6/12/11Amber140 6/12/11Amber185
Answered Same DayJul 12, 2021

Answer To: 1 Mashing Up Data with PowerPivot* When “Filter, Then Calculate” Does Not Work in DAX Measures This...

Pooja answered on Jul 13 2021
156 Votes
Sheet1
            Representitative
            Amber                                Bill                                Chris                                Dale                                Eddy                                Total Sum of Sales    Total % of Amber Sales    Total MTDThisRep    Total % of MTD    Total % of Grand Total    Total % of Daily Sales    Total Amber Sales    Total MTDAllRep
        Date    Sum of Sales    % of Amber Sales    MTDThisRep    % of MTD    % of Grand Total    % of Daily Sales    Amber Sales    MTDAllRep    Sum of Sales    % of Amber Sales    MTDThisRep    % of MTD    % of Grand Total    % of Daily Sales    Amber Sales    MTDAllRep    Sum of Sales    % of Amber Sales    MTDThisRep    % of MTD    % of Grand Total    % of Daily Sales    Amber Sales    MTDAllRep    Sum of Sales    % of Amber Sales    MTDThisRep    % of MTD    % of Grand Total    % of Daily Sales    Amber Sales    MTDAllRep    Sum of Sal
es    % of Amber Sales    MTDThisRep    % of MTD    % of Grand Total    % of Daily Sales    Amber Sales    MTDAllRep
        6/1/11    1083    100 %    1083    69 %    0.0110814378    0.6915708812    1083    1566    346    32 %    346    22 %    0.0035403301    0.220945083    1083    1566    49    5 %    49    3 %    0.0005013762    0.0312899106    1083    1566    88    8 %    88    6 %    0.0009004308    0.0561941252    1083    1566                                    1566    145 %    1566    100 %    0.0160235749    1    1083    1566
        6/2/11    1094    100 %    2177    44 %    0.0111939917    0.321386604    1094    4970    851    78 %    1197    24 %    0.0087075749    0.25    1094    4970    429    39 %    478    10 %    0.0043896    0.1260282021    1094    4970    359    33 %    447    9 %    0.0036733483    0.1054641598    1094    4970    671    61 %    671    14 %    0.0068657847    0.1971210341    1094    4970    3404    311 %    4970    100 %    0.0348302995    1    1094    4970
        6/3/11    1444    100 %    3621    41 %    0.0147752504    0.3832271762    1444    8738    765    53 %    1962    22 %    0.0078276084    0.2030254777    1444    8738    1028    71 %    1506    17 %    0.0105186686    0.2728237792    1444    8738    236    16 %    683    8 %    0.0024147916    0.0626326964    1444    8738    295    20 %    966    11 %    0.0030184895    0.0782908705    1444    8738    3768    261 %    8738    100 %    0.0385548086    1    1444    8738
        6/4/11    954    100 %    4575    40 %    0.0097614882    0.365097589    954    11351    659    69 %    2621    23 %    0.0067429986    0.2522005358    954    11351    851    89 %    2357    21 %    0.0087075749    0.3256792958    954    11351                                    149    16 %    1115    10 %    0.001524593    0.0570225794    954    11351    2613    274 %    11351    100 %    0.0267366547    1    954    11351
        6/5/11    900    100 %    5475    38 %    0.0092089511    0.294599018    900    14406    1304    145 %    3925    27 %    0.0133427469    0.4268412439    900    14406    578    64 %    2935    20 %    0.005914193    0.189198036    900    14406    137    15 %    820    6 %    0.001401807    0.0448445172    900    14406    136    15 %    1251    9 %    0.0013915748    0.0445171849    900    14406    3055    339 %    14406    100 %    0.0312592729    1    900    14406
        6/6/11    533    100 %    6008    35 %    0.0054537455    0.193115942    533    17166    1201    225 %    5126    30 %    0.0122888336    0.4351449275    533    17166    526    99 %    3461    20 %    0.0053821203    0.1905797101    533    17166    153    29 %    973    6 %    0.0015655217    0.0554347826    533    17166    347    65 %    1598    9 %    0.0035505623    0.1257246377    533    17166    2760    518 %    17166    100 %    0.0282407834    1    533    17166
        6/7/11    1184    100 %    7192    36 %    0.0121148868    0.4085576259    1184    20064    976    82 %    6102    30 %    0.0099865959    0.336783989    1184    20064    558    47 %    4019    20 %    0.0057095497    0.1925465839    1184    20064    143    12 %    1116    6 %    0.0014632    0.0493443754    1184    20064    37    3 %    1635    8 %    0.0003785902    0.0127674258    1184    20064    2898    245 %    20064    100 %    0.0296528225    1    1184    20064
        6/8/11    2018    100 %    9210    39 %    0.0206485148    0.5433494884    2018    23778    338    17 %    6440    27 %    0.0034584727    0.0910070005    2018    23778    765    38 %    4784    20 %    0.0078276084    0.2059773829    2018    23778    80    4 %    1196    5 %    0.0008185734    0.0215401185    2018    23778    513    25 %    2148    9 %    0.0052491021    0.1381260097    2018    23778    3714    184 %    23778    100 %    0.0380022715    1    2018    23778
        6/9/11    1038    100 %    10248    38 %    0.0106209903    0.3228615863    1038    26993    858    83 %    7298    27 %    0.0087792    0.266874028    1038    26993    463    45 %    5247    19 %    0.0047374937    0.1440124417    1038    26993    322    31 %    1518    6 %    0.0032947581    0.100155521    1038    26993    534    51 %    2682    10 %    0.0054639777    0.166096423    1038    26993    3215    310 %    26993    100 %    0.0328964198    1    1038    26993
        6/10/11    1105    100 %    11353    38 %    0.0113065455    0.4160391566    1105    29649    201    18 %    7499    25 %    0.0020566657    0.0756777108    1105    29649    436    39 %    5683    19 %    0.0044612252    0.1641566265    1105    29649    507    46 %    2025    7 %    0.0051877091    0.1908885542    1105    29649    407    37 %    3089    10 %    0.0041644923    0.1532379518    1105    29649    2656    240 %    29649    100 %    0.0271766379    1    1105    29649
        6/11/11    2495    100 %    13848    40 %    0.0255292589    0.4647047867    2495    35018    1197    48 %    8696    25 %    0.012247905    0.222946545    2495    35018    702    28 %    6385    18 %    0.0071829819    0.1307506053    2495    35018    668    27 %    2693    8 %    0.0068350882    0.1244179549    2495    35018    307    12 %    3396    10 %    0.0031412755    0.057180108    2495    35018    5369    215 %    35018    100 %    0.0549365094    1    2495    35018
        6/12/11    1113    100 %    14961    40 %    0.0113884029    0.4188934889    1113    37675    435    39 %    9131    24 %    0.004450993    0.1637184795    1113    37675    29    3 %    6414    17 %    0.0002967329    0.0109145653    1113    37675    752    68 %    3445    9 %    0.0076945903    0.2830259691    1113    37675    328    29 %    3724    10 %    0.0033561511    0.1234474972    1113    37675    2657    239 %    37675    100 %    0.0271868701    1    1113    37675
        6/13/11    1845    100 %    16806    38 %    0.0188783498    0.3020134228    1845    43784    1572    85 %    10703    24 %    0.0160849679    0.2573252578    1845    43784    1550    84 %    7964    18 %    0.0158598602    0.2537240138    1845    43784    1019    55 %    4464    10 %    0.0104265791    0.1668030774    1845    43784    123    7 %    3847    9 %    0.0012585567    0.0201342282    1845    43784    6109    331 %    43784    100 %    0.0625083136    1    1845    43784
        6/14/11    1667    100 %    18473    39 %    0.0170570239    0.4498111171    1667    47490    520    31 %    11223    24 %    0.0053207273    0.1403130059    1667    47490    534    32 %    8498    18 %    0.0054639777    0.1440906638    1667    47490    747    45 %    5211    11 %    0.0076434294    0.2015650297    1667    47490    238    14 %    4085    9 %    0.002435256    0.0642201835    1667    47490    3706    222 %    47490    100 %    0.0379204142    1    1667    47490
        6/15/11    1951    100 %    20424    40 %    0.0199629596    0.569302597    1951    50917    186    10 %    11409    22 %    0.0019031832    0.054274876    1951    50917    736    38 %    9234    18 %    0.0075308756    0.2147651007    1951    50917    554    28 %    5765    11 %    0.005668621    0.1616574263    1951    50917                                    3427    176 %    50917    100 %    0.0350656394    1    1951    50917
        6/16/11    441    100 %    20865    39 %    0.004512386    0.1721311475    441    53479    773    175 %    12182    23 %    0.0079094658    0.3017174083    441    53479    1143    259 %    10377    19 %    0.0116953679    0.4461358314    441    53479    205    46 %    5970    11 %    0.0020975944    0.0800156128    441    53479                                    2562    581 %    53479    100 %    0.0262148141    1    441    53479
        6/17/11    556    100 %    21421    38 %    0.0056890853    0.1643997635    556    56861    1157    208 %    13339    23 %    0.0118386182    0.3421052632    556    56861    478    86 %    10855    19 %    0.0048909763    0.1413364873    556    56861    917    165 %    6887    12 %    0.009382898    0.2711413365    556    56861    274    49 %    4359    8 %    0.002803614    0.0810171496    556    56861    3382    608 %    56861    100 %    0.0346051918    1    556    56861
        6/18/11    660    100 %    22081    37 %    0.0067532308    0.1821694728    660    60484    1458    221 %    14797    24 %    0.0149185008    0.4024289263    660    60484    831    126 %    11686    19 %    0.0085029315    0.2293679271    660    60484    515    78 %    7402    12 %    0.0052695665    0.1421473917    660    60484    159    24 %    4518    7 %    0.0016269147    0.0438862821    660    60484    3623    549 %    60484    100 %    0.0370711443    1    660    60484
        6/19/11    758    100 %    22839    36 %    0.0077559833    0.2389659521    758    63656    518    68 %    15315    24 %    0.005300263    0.1633039092    758    63656    1422    188 %    13108    21 %    0.0145501427    0.448297604    758    63656    474    63 %    7876    12 %    0.0048500476    0.1494325347    758    63656                                    3172    418 %    63656    100...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here