Forum Discussion

andrejaar's avatar
andrejaar
Frequent Visitor
8 years ago

Time Intelligence Quarters - Purchases

Hi,

My Goal is to know:

   - Quantiy bought in current quarter ( CALCULATE(Sum(fDados[Quantity]);DATESQTD(dCalendar[Date]))    )

   - Average Price Current Quarter ( CALCULATE(AVERAGE(fDados[Unit Pice]);DATESQTD(dCalendar[Date])) )

   - Aerage Price LAst Quarter ( CALCULATE(AVERAGE(fDados[Unit Pice]);PREVIOUSQUARTER(dCalendar[Date])) )

Calculation:

   If i have both products with purchases in both quarters,  than do the follwing:

     ( Current Av.Price * Current Quarter Quantity ) - ( Last Av.Price * Current Quarter Quantity )

 

I've done ton of trying...even got what i expected in the rows but the mesure was not doing total:

 

 

Total Diff = 
VAR Qty = CALCULATE(Sum(fDados[Quantity]);DATESQTD(dCalendar[Date]))

VAR Actual= CALCULATE(AVERAGE(fDados[Unit Pice]);DATESQTD(dCalendar[Date]))
VAR Last = CALCULATE(AVERAGE(fDados[Unit Pice]);PREVIOUSQUARTER(dCalendar[Date]))

VAR Total = IF( Actual> 0 && Last > 0 ;CALCULATE( (Actual* Qty ) - (Last *Qty ) ) ; BLANK())
RETURN IF(HASONEVALUE(fDados[Product]);Total;BLANK())

 

 

the problem is that it do not compute Total(sum)... onyl shows the values in the matrix.

 

I've did some other testing but unsucefull

Well...hope someone can help me :D

 

Regards!

3 Replies