# View: ph_audit_merlinrebates

**View Name:** ph_audit_merlinrebates
**Table Source:** `Derived from: Prod.Dim_Country, Prod.Dim_Label, Prod.Dim_Release, Prod.Workstation_Fact_Sales_Unified_Dbt, Royalty_Accounting + 1 more`
**File Path:** `ph_audit_merlinrebates.view.lkml`

## Overview

- **File Size:** 9275 bytes
- **Lines of Code:** 60
- **Dimensions:** 6
- **Measures:** 1
- **Dimension Groups:** 0
- **Filters:** 0

## Dimensions

| Name | Type |
|------|------|
| `labelid` | string |
| `labelname` | string |
| `activityyear` | string |
| `releaseid` | string |
| `country_code` | string |
| `sumfs_gross` | number |

## Measures

| Name | Type |
|------|------|
| `count` | count |

## SQL Comments

- and l.owner in ('Finetunes','FT-NY')

## Derived Table

```sql
sql: select  fs.labelid, l.labelname,  fs.activityyear, fs.releaseid, c.country_code,  sum(fs.gross)
      from royalty_accounting.prod.workstation_fact_sales_unified_dbt fs
      inner join facts.prod.dim_country c on c.countryid=fs.countryid
      inner join facts.prod.dim_release r on r.releaseid=fs.releaseid
      inner join facts.prod.dim_label l on l.labelid=fs.labelid
      where  fs.storeid=286 and fs.activityyear in (2019, 2020)
      --and l.owner in ('Finetunes','FT-NY')
      and fs.labelid in (26276,27581,27078,27069,26983,27661,27393,28394,27053,27323,27540,28101,28058,27353,27153,27779,27795,27518,27603,27087,28008,27188,27443,27963,27902,26756,28418,28094,28047,28391,27412,27777,27201,28087,27690,27615,27971,27683,27305,27938,27782,27081,27231,27778,27901,27266,27504,27156,27317,27088,27374,27145,27733,27756,27921,28207,26953,27807,27004,27897,27973,27086,27759,28010,27388,27556,27010,27391,27941,27015,27895,27302,26936,27444,27360,27815,26977,28043,26943,28397,27801,27757,27310,26971,27239,27424,28173,27996,27869,27229,27932,27697,27916,27512,27560,27758,27814,26942,27056,27366,26926,27223,27881,28068,27521,27899,27519,27930,27106,27352,28137,27358,27372,27490,28400,26987,28142,27197,27774,28018,26997,27833,28177,27923,27679,28401,27775,26979,27991,27605,27866,26975,27084,27395,28071,27090,27271,27564,27879,27123,27319,27796,27453,26985,27889,28164,27488,27511,27280,27665,27176,27766,27495,28120,28083,27143,27633,27127,28055,28013,27837,27545,27299,27290,27584,27998,27449,27579,27003,27456,27102,26947,27640,27173,27442,28193,27984,28099,28594,27912,28161,9287,28031,28219,27591,27790,27006,27369,28095,28076,26931,27264,28027,27315,27694,28411,27701,27590,27159,27392,28407,28053,27112,28102,27992,27755,27293,27371,27834,27599,26965,27780,26912,26984,27033,27192,27637,27465,28392,27336,27097,27573,27382,27104,27158,27149,27359,28042,27416,27065,27750,27754,27363,28100,27002,27410,27435,28020,28211,27811,26958,26923,28190,28116,26955,27980,27760,27857,28124,27913,28226,27325,28414,27737,28189,27588,28079,27822,27709,32714,28381,27440,27826,27035,28195,27653,27783,27445,28072,27079,27634,27571,28157,27630,28390,27920,27114,27423,27408,28405,27808,27466,27527,27829,27686,28171,28061,27252,27343,27312,27458,27555,27057,28402,28192,27232,26930,27587,27155,26954,28156,28033,27883,27649,27685,27931,27219,27516,28046,26937,27199,28066,27537,27094,27107,28412,27703,22050,28115,27296,27608,27717,27070,27047,27476,26913,27387,27792,27467,28009,27422,27999,27093,28408,26968,27116,27531,27629,28000,27693,27128,28165,28387,28041,27863,27832,27483,27943,27830,27064,27940,32582,27816,27865,27696,26998,28063,27506,27663,27129,26935,27487,28595,27012,28179,27415,27208,27854,27101,27247,27794,27478,27622,27370,27401,27115,27804,27307,27061,28029,27394,27118,28104,27845,27853,27841,26921,27355,27162,28178,27447,27067,27194,27767,27810,27846,27626,28005,27707,28036,27164,28386,27009,28154,27535,26950,27240,27180,27480,27721,27939,28368,27008,27735,28022,27200,27269,28088,27294,27245,27278,27185,27420,27367,28153,27926,27036,27196,28097,28062,27268,28103,28175,27666,27117,27567,27547,27044,27038,27147,28389,28015,28145,28404,27256,27809,28222,27597,27918,27990,27886,27736,27994,27368,27050,28596,27168,27823,27212,27725,27350,27652,28032,27772,24988,27609,27732,28050,27616,27658,27961,27303,27719,27691,27650,27586,27751,27933,27585,27446,27385,26967,27330,27872,27439,27027,27227,27529,27468,28380,27662,27880,27773,28089,28139,27306,27681,27414,27398,27969,25014,28223,26949,27613,26946,28028,27021,27765,27228,27258,27037,27507,26920,27152,27905,27620,27464,27968,27432,27713,27831,27089,27322,27982,28140,27915,27179,27838,27612,26972,27887,27043,27331,27171,27459,28109,27020,27638,26909,28199,27272,28224,27656,27131,26951,26969,26966,27876,27566,28395,27842,32417,28025,28146,27589,27071,27469,26990,27824,27536,27744,26981,27100,28141,27174,28117,27799,27122,28012,27953,26959,27429,27251,27559,27595,27648,27321,27553,26933,27034,27791,26986,27763,27715,28593,27730,27552,27235,27522,27058,27225,26929,26924,27788,28382,26915,27238,27972,27244,27253,28399,27614,28170,28039,27160,28151,27868,28229,28081,27861,27934,27430,27928,28196,27175,32113,28119,27032,27473,26988,28014,27082,28168,28180,27213,27596,27890,26952,27450,27908,27426,27146,27919,27893,27675,27267,27544,27287,27500,27501,28197,27165,32426,27820,28051,26925,27019,27121,32829,27431,27643,27427,27292,28630,27706,27324,27924,28152,27839,27063,28209,27563,33104,27092,28125,27513,27672,27482,27738,27279,28191,27740,27689,27407,27524,27554,27847,26996,27354,28155,28217,27561,27274,28034,27592,27957,26970,27341,32494,27040,27451,28770,28026,27851,27433,28252,27702,27836,27753,28668,27320,27046,27673,27888,27907,27170,28078,27803,27144,27821,27747,27639,28011,27136,27191,27135,27993,27378,27248,27942,27698,27625,27785,27221,28148,27098,27882,27974,28030,28121,27448,27548,27277,27677,28415,28203,27651,28204,27260,28388,27364,28133,26980,27710,28615,27499,27789,27425,27949,27956,26916,27051,27770,28065,27029,27922,27819,27329,27138,27345,27428,28037,27347,27203,27215,27154,27187,28035,27348,28612,27864,27454,27346,27551,28045,27642,26917,27421,27986,27606,27849,27860,27068,27224,26960,27577,27493,27574,27381,27291,27028,27210,27409,26927,27676,27237,27600,28129,27351,27962,28105,27746,27484,27167,27402,27636,26940,28150,27139,28208,27856,27396,26938,28213,27852,26994,26963,27463,27896,27576,27528,27311,27202,27286,28107,27894,26956,27470,27530,27126,27452,27249,28080,27157,27103,27397,26989,27623,27745,27654,27950,28147,27182,28127,27375,27365,27958,27110,27013,27195,28186,28194,27682,27966,27793,33049,27644,27014,27959,27265,27039,27802,27000,28188,26957,26922,28130,27337,27873,28724,27386,27835,27406,27674,27985,27189,27314,27903,27017,27243,27177,27558,28134,27049,27743,27960,27797,27965,27727,27952,28044,27270,27349,28166,28160,27373,27871,26932,27909,27925,27568,27664,27376,27786,27569,27475,27481,28003,28172,27734,27108,27601,27787,27390,27858,27805,27975,27301,27276,27054,27997,27884,27316,27262,27813,27211,28181,27967,28110,28669,28082,28451,27539,27134,27848,27904,27885,27891,27041,27083,27700,27935,27867,27273,27148,27001,28202,26919,27166,27436,27334,26918,27403,33085,27285,28416,28016,27214,27125,26976,27193,26991,28218,28052,28149,27220,27169,27496,28448,27018,28091,28048,27660,28613,27356,27151,27776,27505,27080,26948,28001,28112,27419,28220,27641,28023,27198,27532,27723,27593,26964,28086,27091,27132,27741,27695,27825,27728,27342,27142,27163,27491,27523,27404,27929,27494,27498,28111,28075,27621,27645,27526,27119,27525,27699,33057,27218,27927,26941,27964,28158,27074,32995,27989,28069,27283,28126,27361,27533,27611,27610,27898,27937,27668,27460,27434,27209,28200,28614,27635,27604,28187,27812,28406,27023,27150,27669,28122,27062,27457,27380,27085,27437,27565,27318,27878,27400,27379,28143,28084,27016,27843,27781,28056,28452,28144,26999,27161,28591,27399,27113,28447,27066,27582,27598,26944,27692,27546,27911,26978,27917,28135,27332,28054,27983,27618,27216,27850,26995,28090,27627,27255,33117,27726,27948,27945,27492,26939,27339,28201,27936,28113,27072,27944,28038,27914,27226,27048,28174,27954,26992,27095,26928,27502,27538,26973,27549,28002,27570,27308,27800,27572,27241,27328,27076,28410,28169,27976,27670,27684,27520,27417,27678,27955,27257,26974,27184,27877,26962,27172,27413,27479,27222,28131,27011,28184,27289,28629,27711,28449,27542,27632,27141,27769,26911,27541,27978,28214,28070,27768,27377,26910,27970,27617,27236,27075,28206,27474,27602,27335,27771,27333,27655,26914,27030,27705,27340,27288,27714,27472,28182,28108,27752,27718,27515,28385,27246,27181,27297,27007,28167,28212,27441,27946,27357,27124,27870,28067,28093,32521,27910,27517,28176,27418,27326,27981,27045,27687,28136,28227,27827,26982,27748,27667,28024,28006,27073,27411,27485,27109,27607,27818,27096,27543,27708,27254,28049,27874,27900,27217,28096,27729,27840,27594,28064,27133,27327,28077,27762,27906,27688,27389,27509,27659,27859,27583,28092,27313,27077,27580,28059,27722,27731,28251,27438,28114,27557,27471,27461,26993,28163,27562,27761,27344,28007,27362,27186,27575,28225,27749,27031,27477,27183,27261,27798,27130,28183,27647,28250,27892,28060,27951,27026,27099,27263,28162,27206,27140,28228,28085,28074,27060,27055,27489,27977,27631,28017,27383,28216,27281,28123,27304,27739,28205,27111,26945,27764,28106,27875,28138,27250,27828,27497,28198,27979,27052,27510,27284,27947,27455,27178,27844,27233,27105,32956,33134)
        group by 1,2,3,4,5
       ;;
```

