powered by simpleCommunicator - 2.0.59     © 2025 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / OLAP и DWH [игнор отключен] [закрыт для гостей] / MDX урезанный показатель
7 сообщений из 7, страница 1 из 1
MDX урезанный показатель
    #39982136
Фотография a_voronin
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Господа,
есть такой вопрос по MDX.

Имеется показатель Х -- некая сумма проданного например.

Имеются измерения A и B и элементами. A1 A2 A3 A4 A5 A6 и B1 B2 B3 B4 B5 .

Есть некое фильтрующее множество

SET FilterAB AS
{
A1 * { B1, B4 },
A3 * {B2, B5, B6},
A6 * {B1, B2, B3},
}

Нужно сделать показатель MEMBER X1 AS SUM(FilterAB, X)

то есть из общей суммы взять только сумму по комбинациям элементам.

Теперь внимание вопрос, если на оси MDX выбран элемент B2, то данная сумма будет суммировать по всему фильтру. Как сделать так, чтобы фильтр обрезался с учетом выбранных на оси элементов. То есть SUM({A3 * B2, A6 * B2, X) ?

Я пробовал по SUM(EXISTING (DESCENDANTS(A.All, 1) * EXISTING (DESCENDANTS(B.All, 1) * FilterAB, X ) результат дает, но медленно. Есть ли более изящный и оптимальный способ?
...
Рейтинг: 0 / 0
MDX урезанный показатель
    #39982194
ShIgor
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
a_voronin,

Не совсем MDX.
Если комбинации почти постоянные, то я использую такой (на картинке) подход
причем членов в измерении F может быть много и вариантов комбинаций может быть много.
...
Рейтинг: 0 / 0
MDX урезанный показатель
    #39982199
ShIgor
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
ShIgor,

скрипт куба
здесь
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.
288.
289.
290.
291.
292.
293.
294.
295.
296.
297.
298.
299.
300.
301.
302.
303.
304.
305.
306.
307.
308.
309.
310.
311.
312.
313.
314.
315.
316.
317.
318.
319.
320.
321.
322.
323.
324.
325.
326.
327.
328.
329.
330.
331.
332.
333.
334.
335.
336.
337.
338.
339.
340.
341.
342.
343.
344.
345.
346.
347.
348.
349.
350.
351.
352.
353.
354.
355.
356.
357.
358.
359.
360.
361.
362.
363.
364.
365.
366.
367.
368.
369.
370.
371.
372.
373.
374.
375.
376.
377.
378.
379.
380.
381.
382.
383.
384.
385.
386.
387.
388.
389.
390.
391.
392.
393.
394.
395.
396.
397.
398.
399.
400.
401.
402.
403.
404.
405.
406.
407.
408.
409.
410.
411.
412.
413.
414.
415.
416.
417.
418.
419.
420.
421.
422.
423.
424.
425.
426.
427.
428.
429.
430.
431.
432.
433.
434.
435.
436.
437.
438.
439.
440.
441.
442.
443.
444.
445.
446.
447.
448.
449.
450.
451.
452.
453.
454.
455.
456.
457.
458.
459.
460.
461.
462.
463.
464.
465.
466.
467.
468.
469.
470.
471.
472.
473.
474.
475.
476.
477.
478.
479.
480.
481.
482.
483.
484.
485.
486.
487.
488.
489.
<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
    <ObjectDefinition>
        <Database xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200" xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300" xmlns:ddl400="http://schemas.microsoft.com/analysisservices/2012/engine/400" xmlns:ddl400_400="http://schemas.microsoft.com/analysisservices/2012/engine/400/400" xmlns:ddl500="http://schemas.microsoft.com/analysisservices/2013/engine/500" xmlns:ddl500_500="http://schemas.microsoft.com/analysisservices/2013/engine/500/500">
            <ID>MD_AbyB</ID>
            <Name>MD_AbyB</Name>
            <ddl200:CompatibilityLevel>1100</ddl200:CompatibilityLevel>
            <Language>1049</Language>
            <Collation>Cyrillic_General_CI_AS</Collation>
            <DataSourceImpersonationInfo>
                <ImpersonationMode>Default</ImpersonationMode>
            </DataSourceImpersonationInfo>
            <Dimensions>
                <Dimension>
                    <ID>A</ID>
                    <Name>A</Name>
                    <Source xsi:type="DataSourceViewBinding">
                        <DataSourceViewID>dsv</DataSourceViewID>
                    </Source>
                    <ErrorConfiguration>
                        <KeyNotFound>ReportAndStop</KeyNotFound>
                        <KeyDuplicate>ReportAndStop</KeyDuplicate>
                        <NullKeyNotAllowed>ReportAndStop</NullKeyNotAllowed>
                    </ErrorConfiguration>
                    <Language>1049</Language>
                    <Collation>Cyrillic_General_CI_AS</Collation>
                    <UnknownMemberName>Unknown</UnknownMemberName>
                    <Attributes>
                        <Attribute>
                            <ID>A</ID>
                            <Name>A</Name>
                            <Usage>Key</Usage>
                            <KeyColumns>
                                <KeyColumn>
                                    <DataType>Integer</DataType>
                                    <Source xsi:type="ColumnBinding">
                                        <TableID>nqA</TableID>
                                        <ColumnID>a_key</ColumnID>
                                    </Source>
                                </KeyColumn>
                            </KeyColumns>
                            <NameColumn>
                                <DataType>WChar</DataType>
                                <DataSize>10</DataSize>
                                <Source xsi:type="ColumnBinding">
                                    <TableID>nqA</TableID>
                                    <ColumnID>a_name</ColumnID>
                                </Source>
                            </NameColumn>
                            <OrderBy>Key</OrderBy>
                        </Attribute>
                    </Attributes>
                    <ProactiveCaching>
                        <SilenceInterval>-PT1S</SilenceInterval>
                        <Latency>-PT1S</Latency>
                        <SilenceOverrideInterval>-PT1S</SilenceOverrideInterval>
                        <ForceRebuildInterval>-PT1S</ForceRebuildInterval>
                        <Source xsi:type="ProactiveCachingInheritedBinding" />
                    </ProactiveCaching>
                </Dimension>
                <Dimension>
                    <ID>B</ID>
                    <Name>B</Name>
                    <Source xsi:type="DataSourceViewBinding">
                        <DataSourceViewID>dsv</DataSourceViewID>
                    </Source>
                    <ErrorConfiguration>
                        <KeyNotFound>ReportAndStop</KeyNotFound>
                        <KeyDuplicate>ReportAndStop</KeyDuplicate>
                        <NullKeyNotAllowed>ReportAndStop</NullKeyNotAllowed>
                    </ErrorConfiguration>
                    <Language>1049</Language>
                    <Collation>Cyrillic_General_CI_AS</Collation>
                    <UnknownMemberName>Unknown</UnknownMemberName>
                    <Attributes>
                        <Attribute>
                            <ID>B</ID>
                            <Name>B</Name>
                            <Usage>Key</Usage>
                            <KeyColumns>
                                <KeyColumn>
                                    <DataType>Integer</DataType>
                                    <Source xsi:type="ColumnBinding">
                                        <TableID>nqValues</TableID>
                                        <ColumnID>b_key</ColumnID>
                                    </Source>
                                </KeyColumn>
                            </KeyColumns>
                            <NameColumn>
                                <DataType>WChar</DataType>
                                <DataSize>10</DataSize>
                                <Source xsi:type="ColumnBinding">
                                    <TableID>nqValues</TableID>
                                    <ColumnID>b_name</ColumnID>
                                </Source>
                            </NameColumn>
                            <OrderBy>Key</OrderBy>
                        </Attribute>
                    </Attributes>
                    <ProactiveCaching>
                        <SilenceInterval>-PT1S</SilenceInterval>
                        <Latency>-PT1S</Latency>
                        <SilenceOverrideInterval>-PT1S</SilenceOverrideInterval>
                        <ForceRebuildInterval>-PT1S</ForceRebuildInterval>
                        <Source xsi:type="ProactiveCachingInheritedBinding" />
                    </ProactiveCaching>
                </Dimension>
                <Dimension>
                    <ID>F</ID>
                    <Name>F</Name>
                    <Source xsi:type="DataSourceViewBinding">
                        <DataSourceViewID>dsv</DataSourceViewID>
                    </Source>
                    <ErrorConfiguration>
                        <KeyNotFound>ReportAndStop</KeyNotFound>
                        <KeyDuplicate>ReportAndStop</KeyDuplicate>
                        <NullKeyNotAllowed>ReportAndStop</NullKeyNotAllowed>
                    </ErrorConfiguration>
                    <Language>1049</Language>
                    <Collation>Cyrillic_General_CI_AS</Collation>
                    <UnknownMemberName>Unknown</UnknownMemberName>
                    <Attributes>
                        <Attribute>
                            <ID>Filter</ID>
                            <Name>Filter</Name>
                            <Usage>Key</Usage>
                            <KeyColumns>
                                <KeyColumn>
                                    <DataType>Integer</DataType>
                                    <Source xsi:type="ColumnBinding">
                                        <TableID>nqDimFilter</TableID>
                                        <ColumnID>f_key</ColumnID>
                                    </Source>
                                </KeyColumn>
                            </KeyColumns>
                            <NameColumn>
                                <DataType>WChar</DataType>
                                <DataSize>10</DataSize>
                                <Source xsi:type="ColumnBinding">
                                    <TableID>nqDimFilter</TableID>
                                    <ColumnID>f_name</ColumnID>
                                </Source>
                            </NameColumn>
                        </Attribute>
                    </Attributes>
                    <ProactiveCaching>
                        <SilenceInterval>-PT1S</SilenceInterval>
                        <Latency>-PT1S</Latency>
                        <SilenceOverrideInterval>-PT1S</SilenceOverrideInterval>
                        <ForceRebuildInterval>-PT1S</ForceRebuildInterval>
                        <Source xsi:type="ProactiveCachingInheritedBinding" />
                    </ProactiveCaching>
                </Dimension>
            </Dimensions>
            <Cubes>
                <Cube>
                    <ID>cube</ID>
                    <Name>cube</Name>
                    <Language>1049</Language>
                    <Collation>Cyrillic_General_CI_AS</Collation>
                    <Dimensions>
                        <Dimension>
                            <ID>A</ID>
                            <Name>A</Name>
                            <DimensionID>A</DimensionID>
                            <Attributes>
                                <Attribute>
                                    <AttributeID>A</AttributeID>
                                </Attribute>
                            </Attributes>
                        </Dimension>
                        <Dimension>
                            <ID>B</ID>
                            <Name>B</Name>
                            <DimensionID>B</DimensionID>
                            <Attributes>
                                <Attribute>
                                    <AttributeID>B</AttributeID>
                                </Attribute>
                            </Attributes>
                        </Dimension>
                        <Dimension>
                            <ID>F</ID>
                            <Name>F</Name>
                            <DimensionID>F</DimensionID>
                            <Attributes>
                                <Attribute>
                                    <AttributeID>Filter</AttributeID>
                                </Attribute>
                            </Attributes>
                        </Dimension>
                    </Dimensions>
                    <MeasureGroups>
                        <MeasureGroup>
                            <ID>Nq Facts</ID>
                            <Name>Nq Facts</Name>
                            <Measures>
                                <Measure>
                                    <ID>V</ID>
                                    <Name>V</Name>
                                    <DataType>Integer</DataType>
                                    <Source>
                                        <DataType>Integer</DataType>
                                        <Source xsi:type="ColumnBinding">
                                            <TableID>nqWeights</TableID>
                                            <ColumnID>v</ColumnID>
                                        </Source>
                                    </Source>
                                </Measure>
                            </Measures>
                            <StorageMode>Molap</StorageMode>
                            <ProcessingMode>Regular</ProcessingMode>
                            <Dimensions>
                                <Dimension xsi:type="RegularMeasureGroupDimension">
                                    <CubeDimensionID>A</CubeDimensionID>
                                    <Attributes>
                                        <Attribute>
                                            <AttributeID>A</AttributeID>
                                            <KeyColumns>
                                                <KeyColumn>
                                                    <DataType>Integer</DataType>
                                                    <Source xsi:type="ColumnBinding">
                                                        <TableID>nqWeights</TableID>
                                                        <ColumnID>a_key</ColumnID>
                                                    </Source>
                                                </KeyColumn>
                                            </KeyColumns>
                                            <Type>Granularity</Type>
                                        </Attribute>
                                    </Attributes>
                                </Dimension>
                                <Dimension xsi:type="RegularMeasureGroupDimension">
                                    <CubeDimensionID>B</CubeDimensionID>
                                    <Attributes>
                                        <Attribute>
                                            <AttributeID>B</AttributeID>
                                            <KeyColumns>
                                                <KeyColumn>
                                                    <DataType>Integer</DataType>
                                                    <Source xsi:type="ColumnBinding">
                                                        <TableID>nqWeights</TableID>
                                                        <ColumnID>b_key</ColumnID>
                                                    </Source>
                                                </KeyColumn>
                                            </KeyColumns>
                                            <Type>Granularity</Type>
                                        </Attribute>
                                    </Attributes>
                                </Dimension>
                                <Dimension xsi:type="ManyToManyMeasureGroupDimension">
                                    <CubeDimensionID>F</CubeDimensionID>
                                    <MeasureGroupID>Nq Filter Map</MeasureGroupID>
                                </Dimension>
                            </Dimensions>
                            <Partitions>
                                <Partition>
                                    <ID>Nq Facts</ID>
                                    <Name>Nq Facts</Name>
                                    <Source xsi:type="DsvTableBinding">
                                        <DataSourceViewID>dsv</DataSourceViewID>
                                        <TableID>nqWeights</TableID>
                                    </Source>
                                    <StorageMode>Molap</StorageMode>
                                    <ProcessingMode>Regular</ProcessingMode>
                                    <ProactiveCaching>
                                        <SilenceInterval>-PT1S</SilenceInterval>
                                        <Latency>-PT1S</Latency>
                                        <SilenceOverrideInterval>-PT1S</SilenceOverrideInterval>
                                        <ForceRebuildInterval>-PT1S</ForceRebuildInterval>
                                        <Source xsi:type="ProactiveCachingInheritedBinding" />
                                    </ProactiveCaching>
                                </Partition>
                            </Partitions>
                            <ProactiveCaching>
                                <SilenceInterval>-PT1S</SilenceInterval>
                                <Latency>-PT1S</Latency>
                                <SilenceOverrideInterval>-PT1S</SilenceOverrideInterval>
                                <ForceRebuildInterval>-PT1S</ForceRebuildInterval>
                                <Source xsi:type="ProactiveCachingInheritedBinding" />
                            </ProactiveCaching>
                        </MeasureGroup>
                        <MeasureGroup>
                            <ID>Nq Filter Map</ID>
                            <Name>Nq Filter Map</Name>
                            <Measures>
                                <Measure>
                                    <ID>V - Nq Filter Map</ID>
                                    <Name>V - Nq Filter Map</Name>
                                    <AggregateFunction>Count</AggregateFunction>
                                    <DataType>Integer</DataType>
                                    <Source>
                                        <DataType>Integer</DataType>
                                        <Source xsi:type="ColumnBinding">
                                            <TableID>nqFilterMap</TableID>
                                            <ColumnID>v</ColumnID>
                                        </Source>
                                    </Source>
                                    <Visible>false</Visible>
                                </Measure>
                            </Measures>
                            <StorageMode>Molap</StorageMode>
                            <ProcessingMode>Regular</ProcessingMode>
                            <Dimensions>
                                <Dimension xsi:type="RegularMeasureGroupDimension">
                                    <CubeDimensionID>A</CubeDimensionID>
                                    <Attributes>
                                        <Attribute>
                                            <AttributeID>A</AttributeID>
                                            <KeyColumns>
                                                <KeyColumn>
                                                    <DataType>Integer</DataType>
                                                    <Source xsi:type="ColumnBinding">
                                                        <TableID>nqFilterMap</TableID>
                                                        <ColumnID>a_key</ColumnID>
                                                    </Source>
                                                </KeyColumn>
                                            </KeyColumns>
                                            <Type>Granularity</Type>
                                        </Attribute>
                                    </Attributes>
                                </Dimension>
                                <Dimension xsi:type="RegularMeasureGroupDimension">
                                    <CubeDimensionID>B</CubeDimensionID>
                                    <Attributes>
                                        <Attribute>
                                            <AttributeID>B</AttributeID>
                                            <KeyColumns>
                                                <KeyColumn>
                                                    <DataType>Integer</DataType>
                                                    <Source xsi:type="ColumnBinding">
                                                        <TableID>nqFilterMap</TableID>
                                                        <ColumnID>b_key</ColumnID>
                                                    </Source>
                                                </KeyColumn>
                                            </KeyColumns>
                                            <Type>Granularity</Type>
                                        </Attribute>
                                    </Attributes>
                                </Dimension>
                                <Dimension xsi:type="RegularMeasureGroupDimension">
                                    <CubeDimensionID>F</CubeDimensionID>
                                    <Attributes>
                                        <Attribute>
                                            <AttributeID>Filter</AttributeID>
                                            <KeyColumns>
                                                <KeyColumn>
                                                    <DataType>Integer</DataType>
                                                    <Source xsi:type="ColumnBinding">
                                                        <TableID>nqFilterMap</TableID>
                                                        <ColumnID>v</ColumnID>
                                                    </Source>
                                                </KeyColumn>
                                            </KeyColumns>
                                            <Type>Granularity</Type>
                                        </Attribute>
                                    </Attributes>
                                </Dimension>
                            </Dimensions>
                            <Partitions>
                                <Partition>
                                    <ID>Nq Filter Map</ID>
                                    <Name>Nq Filter Map</Name>
                                    <Source xsi:type="DsvTableBinding">
                                        <DataSourceViewID>dsv</DataSourceViewID>
                                        <TableID>nqFilterMap</TableID>
                                    </Source>
                                    <StorageMode>Molap</StorageMode>
                                    <ProcessingMode>Regular</ProcessingMode>
                                    <ProactiveCaching>
                                        <SilenceInterval>-PT1S</SilenceInterval>
                                        <Latency>-PT1S</Latency>
                                        <SilenceOverrideInterval>-PT1S</SilenceOverrideInterval>
                                        <ForceRebuildInterval>-PT1S</ForceRebuildInterval>
                                        <Source xsi:type="ProactiveCachingInheritedBinding" />
                                    </ProactiveCaching>
                                </Partition>
                            </Partitions>
                            <ProactiveCaching>
                                <SilenceInterval>-PT1S</SilenceInterval>
                                <Latency>-PT1S</Latency>
                                <SilenceOverrideInterval>-PT1S</SilenceOverrideInterval>
                                <ForceRebuildInterval>-PT1S</ForceRebuildInterval>
                                <Source xsi:type="ProactiveCachingInheritedBinding" />
                            </ProactiveCaching>
                        </MeasureGroup>
                    </MeasureGroups>
                    <Source>
                        <DataSourceViewID>dsv</DataSourceViewID>
                    </Source>
                    <ProactiveCaching>
                        <SilenceInterval>-PT1S</SilenceInterval>
                        <Latency>-PT1S</Latency>
                        <SilenceOverrideInterval>-PT1S</SilenceOverrideInterval>
                        <ForceRebuildInterval>-PT1S</ForceRebuildInterval>
                        <Source xsi:type="ProactiveCachingInheritedBinding" />
                    </ProactiveCaching>
                </Cube>
            </Cubes>
            <DataSources>
                <DataSource xsi:type="RelationalDataSource">
                    <ID>ds</ID>
                    <Name>ds</Name>
                    <ConnectionString>Provider=SQLNCLI11.1;Data Source=.;Integrated Security=SSPI;Initial Catalog=tempdb</ConnectionString>
                    <ImpersonationInfo>
                        <ImpersonationMode>ImpersonateServiceAccount</ImpersonationMode>
                    </ImpersonationInfo>
                    <Timeout>PT0S</Timeout>
                </DataSource>
            </DataSources>
            <DataSourceViews>
                <DataSourceView>
                    <ID>dsv</ID>
                    <Name>dsv</Name>
                    <DataSourceID>ds</DataSourceID>
                    <Schema>
                        <xs:schema id="dsv" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
                            <xs:element name="dsv" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
                                <xs:complexType>
                                    <xs:choice minOccurs="0" maxOccurs="unbounded">
                                        <xs:element name="nqValues" msprop:IsLogical="True" msprop:FriendlyName="nqB" msprop:DbTableName="nqB" msprop:TableType="View" msprop:Description="" msprop:QueryDefinition="select b_key, b_name &#xD;&#xA;from (values &#xD;&#xA;(cast(1 as integer), cast('B1' as nvarchar(10))), &#xD;&#xA;(2, 'B2'), (3, 'B3'), (4, 'B4'), (5, 'B5'), (6, 'B6')&#xD;&#xA;) v (b_key, b_name)" msprop:QueryBuilder="GenericQueryBuilder">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element name="b_key" msprop:DbColumnName="b_key" type="xs:int" minOccurs="0" />
                                                    <xs:element name="b_name" msprop:DbColumnName="b_name" minOccurs="0">
                                                        <xs:simpleType>
                                                            <xs:restriction base="xs:string">
                                                                <xs:maxLength value="10" />
                                                            </xs:restriction>
                                                        </xs:simpleType>
                                                    </xs:element>
                                                </xs:sequence>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="nqWeights" msprop:IsLogical="True" msprop:FriendlyName="nqFacts" msprop:DbTableName="nqFacts" msprop:TableType="View" msprop:Description="" msprop:QueryDefinition="select a.v a_key, b.v b_key, 1 v &#xD;&#xA;from &#xD;&#xA;  (select v from (values (cast(1 as integer)), (2), (3), (4), (5), (6)) v(v)) a &#xD;&#xA;  cross join &#xD;&#xA;  (select v from (values (cast(1 as integer)), (2), (3), (4), (5), (6)) v(v)) b" msprop:QueryBuilder="GenericQueryBuilder">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element name="a_key" msprop:DbColumnName="a_key" type="xs:int" minOccurs="0" />
                                                    <xs:element name="b_key" msprop:DbColumnName="b_key" type="xs:int" minOccurs="0" />
                                                    <xs:element name="v" msprop:DbColumnName="v" type="xs:int" minOccurs="0" />
                                                </xs:sequence>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="nqA" msprop:IsLogical="True" msprop:FriendlyName="nqA" msprop:DbTableName="nqA" msprop:TableType="View" msprop:Description="" msprop:QueryDefinition="select a_key, a_name &#xD;&#xA;from (values &#xD;&#xA;(cast(1 as integer), cast('A1' as nvarchar(10))), &#xD;&#xA;(2, 'A2'), (3, 'A3'), (4, 'A4'), (5, 'A5'), (6, 'A6')&#xD;&#xA;) v (a_key, a_name)" msprop:QueryBuilder="GenericQueryBuilder">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element name="a_key" msdata:ReadOnly="true" msprop:DbColumnName="a_key" msprop:FriendlyName="a_key" type="xs:int" minOccurs="0" />
                                                    <xs:element name="a_name" msdata:ReadOnly="true" msprop:DbColumnName="a_name" msprop:FriendlyName="a_name" minOccurs="0">
                                                        <xs:simpleType>
                                                            <xs:restriction base="xs:string">
                                                                <xs:maxLength value="10" />
                                                            </xs:restriction>
                                                        </xs:simpleType>
                                                    </xs:element>
                                                </xs:sequence>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="nqDimFilter" msprop:IsLogical="True" msprop:FriendlyName="nqFilter" msprop:DbTableName="nqFilter" msprop:TableType="View" msprop:Description="" msprop:QueryDefinition="select f_key, f_name &#xD;&#xA;from (values &#xD;&#xA;--(cast(0 as integer), cast('' as nvarchar(10))), &#xD;&#xA;(1, 'filtered')&#xD;&#xA;) v (f_key, f_name)" msprop:QueryBuilder="GenericQueryBuilder">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element name="f_key" msdata:ReadOnly="true" msprop:DbColumnName="f_key" msprop:FriendlyName="f_key" type="xs:int" minOccurs="0" />
                                                    <xs:element name="f_name" msdata:ReadOnly="true" msprop:DbColumnName="f_name" msprop:FriendlyName="f_name" minOccurs="0">
                                                        <xs:simpleType>
                                                            <xs:restriction base="xs:string">
                                                                <xs:maxLength value="8" />
                                                            </xs:restriction>
                                                        </xs:simpleType>
                                                    </xs:element>
                                                </xs:sequence>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="nqFilterMap" msprop:IsLogical="True" msprop:FriendlyName="nqFilterMap" msprop:DbTableName="nqFilterMap" msprop:TableType="View" msprop:Description="" msprop:QueryDefinition="select * from (&#xD;&#xA;select a.v a_key, b.v b_key, &#xD;&#xA;iif(&#xD;&#xA;  (a.v = 1 and b.v in (1, 4))&#xD;&#xA;  or (a.v = 3 and b.v in (2, 5, 6))&#xD;&#xA;  or (a.v = 6 and b.v in (1, 2, 3)), 1, 0) v &#xD;&#xA;from &#xD;&#xA;  (select v from (values (cast(1 as integer)), (2), (3), (4), (5), (6)) v(v)) a &#xD;&#xA;  cross join &#xD;&#xA;  (select v from (values (cast(1 as integer)), (2), (3), (4), (5), (6)) v(v)) b&#xD;&#xA;) filtermap&#xD;&#xA;where v &lt;&gt; 0" msprop:QueryBuilder="GenericQueryBuilder">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element name="a_key" msdata:ReadOnly="true" msprop:DbColumnName="a_key" msprop:FriendlyName="a_key" type="xs:int" minOccurs="0" />
                                                    <xs:element name="b_key" msdata:ReadOnly="true" msprop:DbColumnName="b_key" msprop:FriendlyName="b_key" type="xs:int" minOccurs="0" />
                                                    <xs:element name="v" msdata:ReadOnly="true" msprop:DbColumnName="v" msprop:FriendlyName="v" type="xs:int" minOccurs="0" />
                                                </xs:sequence>
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:choice>
                                </xs:complexType>
                            </xs:element>
                        </xs:schema>
                        <dsv xmlns="" />
                    </Schema>
                </DataSourceView>
            </DataSourceViews>
        </Database>
    </ObjectDefinition>
</Create>


...
Рейтинг: 0 / 0
MDX урезанный показатель
    #39982209
Фотография a_voronin
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
ShIgor
a_voronin,

Не совсем MDX.
Если комбинации почти постоянные, то я использую такой (на картинке) подход
причем членов в измерении F может быть много и вариантов комбинаций может быть много.


Это и есть написанный мной

SUM(EXISTING (DESCENDANTS(A.All, 1) * EXISTING (DESCENDANTS(B.All, 1) * FilterAB, X )

один в один.

Но нужен MDX для вычисляемого выражения. Возможно с сопутствующими SCOPE.
...
Рейтинг: 0 / 0
MDX урезанный показатель
    #39982442
PassedBI
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Можно попробовать сделать скрытые дубли для элементов A1 A2 A3 A4 A5 A6 и B1 B2 B3 B4 B5
и фильтр-сет переписать через эти суррогаты.
Тогда по идее в показателе сработает эффект auto-exists и оставит пересечения фильтра и оси.
...
Рейтинг: 0 / 0
MDX урезанный показатель
    #39982477
Фотография vikkiv
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
во первых arbitrary shape изначально самое медленное решение (тот самый filterset),
во вторых ещё неизвестно какой MDX интерфейс сгенерирует
ещё с exists тоже могут быть проблемы по какой группе мер работать (доставить последним в соотв. с моделью данных)

на вскидку для простого варианта currentmember в exists должен сработать типа такого:

Код: sql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
with set f as
	tail([Sales Territory].[Sales Territory Country].children,3)
	*head([Product].[Category].children,2)

member x as sum(
	exists(f,[Sales Territory].[Sales Territory Country])
	,[Measures].[Internet Order Quantity])

select {[Measures].[Internet Order Quantity],x} on 0,
[Sales Territory].[Sales Territory Country].members
*[Product].[Category].members
on 1

from [Adventure Works]

where
([Customer].[Number of Cars Owned].&[1]
,[Date].[Calendar].[Month].&[2012]&[12]
)

хотя наверняка ещё можно путей решения настрогать (с вовлечением extract и пр.)
всё тестировать на произв. под нюансы конкретного solution надо (модель, кардинальность и пр.)
Код: sql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
with set f as
	tail([Sales Territory].[Sales Territory Country].children,3)
	*head([Product].[Category].children,2)

member x as sum(
	exists(f,[Sales Territory].[Sales Territory Country])
	,[Measures].[Internet Order Quantity])

select ({x,[Measures].[Internet Order Quantity]},[Product].[Category].members) on 0,
[Sales Territory].[Sales Territory Country].members
on 1

from [Adventure Works]

where
([Customer].[Number of Cars Owned].&[1]
,[Date].[Calendar].[Month].&[2012]&[12]
)
...
Рейтинг: 0 / 0
MDX урезанный показатель
    #39982491
Фотография a_voronin
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
vikkiv

на вскидку для простого варианта currentmember в exists должен сработать типа такого:


C currentmember сразу проблема в том, что если выбраны два элемента, то currentmember = ALL или на 1 уровень выше. И сумма уже не та. А суть вопроса в том, что должен работать правильный механизм обрезания фильтра.
...
Рейтинг: 0 / 0
7 сообщений из 7, страница 1 из 1
Форумы / OLAP и DWH [игнор отключен] [закрыт для гостей] / MDX урезанный показатель
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]