2016-04-11 11 views
0

Son üç ay içinde ürünün minimum satış fiyatını seçen MDX sorgusu yazmaya çalışıyorum, ancak çalışamam. Böyle bir şey denerseniz function "" expects a tuple set expression for the 1 argumentSon üç ay içinde mdx sorgusunda en düşük değer

:

WITH 
    SET [CurrentMonth] AS StrToMember('[Date].[Calendar].[Month].&[' + FORMAT(Now(), "yyyyMM") + ']') 
    SET [LastThreeMonths] AS TAIL({NULL: [CurrentMonth].ITEM(0)}, 3) 
SELECT 
    { 
     min(Tail([LastThreeMonths],3), iif([Measures].[Net sale price] = 0, null, [Measures].[Net sale price])) 
    } ON COLUMNS 
    ,{ 
     [Product].[Product code].MEMBERS 
    } ON ROWS 
FROM [Sales] 
WHERE ( 
     { [Department].[Department name].&[WRO] } 
    ); 

Aşağıdaki hatayı döndürür:

WITH 
    SET [CurrentMonth] AS StrToMember('[Date].[Calendar].[Month].&[' + FORMAT(Now(), "yyyyMM") + ']') 
    SET [LastThreeMonths] AS TAIL({NULL: [CurrentMonth].ITEM(0)}, 3) 
SELECT 
    { 
     (Tail([LastThreeMonths],3), [Measures].[Net sale price]) 
    } ON COLUMNS 
    ,{ 
     [Product].[Product Code].MEMBERS 
    } ON ROWS 
FROM [Sales] 
WHERE ( 
     { [Department].[Department name].&[WRO] } 
    ); 

Çalışıyor

Bu

hiç çalışmıyor benim prototip kodudur ama bu istediğim şey değil - son üç ayın her birinde Net satış fiyatını gösteriyor. MDX'de yeni görevlisiyim, lütfen beni aptalca soruları affet.

+0

: İşte çözüm son üç ay her biri için son üç ay içinde _single_ minimum değeri, ya bir _separate_ minimum değeri istiyorsun? Lütfen bunu açıklığa kavuşturmak için soruyu düzenleyin. – SebTHU

+0

@Dodzik, küpün gelecek aylar içermesi gerektiğini düşünüyor muyum? (küplerimiz gelecekteki tarihleri ​​içermez) – whytheq

+0

@whytheq Ne demek istiyorsun? – Dodzik

cevap

0

Bunu düşünmem için biraz zaman ayırdım ve çözdüm. Bu sizin sorudan net değil

WITH 
    SET [Current month] AS StrToMember('[Date].[Calendar].[Month].&[' + FORMAT(Now(), "yyyyMM") + ']') 
    SET [Last three months] AS LastPeriods(3, [Current month].item(0)) 
    MEMBER [Min price] AS MIN([Last three months], [Measures].[Net sale price]) 
SELECT 
    { 
     [Min price] 
    } ON COLUMNS 
    ,{ 
     [Product].[Product name].MEMBERS 
    } ON ROWS 
FROM [Sales] 
WHERE ( 
     { [Department].[Department name].&[WRO] } 
    ); 
İlgili konular