Forum Discussion
Rolling Value For Last 3 Months
- 1 year ago
Hi,
Try this approach
- Create a Calendar Table with calculated column formulas for Year, Month name and Month number. Sort the Month name by the Month number column
- Create a relationship (Many to One and Single) from the Date column of the Fact table to the Date column of the Calendar table
- To your visual, drag Year and Month name from the Calendar table
- Write these measures
C = sum(Data[Cost])
T = sum(Data[Tonne])
CPT = divide([C],[T])
R3M C = calculate([C],datesbetween(calendar[date],edate(min(calendar[date]),-2),max(calendar[date])))
R3M T = calculate([T],datesbetween(calendar[date],edate(min(calendar[date]),-2),max(calendar[date])))
R3M CPT = divide([R3M C],[R3M T])
Hope this helps.
If the user don't filter the record by conuntry, yes it should be 30+80+210 = 320. sorry for the misunderstandings, the screenshot shows the value filter by country.
Hi,
Try this approach
- Create a Calendar Table with calculated column formulas for Year, Month name and Month number. Sort the Month name by the Month number column
- Create a relationship (Many to One and Single) from the Date column of the Fact table to the Date column of the Calendar table
- To your visual, drag Year and Month name from the Calendar table
- Write these measures
C = sum(Data[Cost])
T = sum(Data[Tonne])
CPT = divide([C],[T])
R3M C = calculate([C],datesbetween(calendar[date],edate(min(calendar[date]),-2),max(calendar[date])))
R3M T = calculate([T],datesbetween(calendar[date],edate(min(calendar[date]),-2),max(calendar[date])))
R3M CPT = divide([R3M C],[R3M T])
Hope this helps.
- ssab_wenx1 year agoFrequent Visitor
Thanks for the reply. It works on local if I don't filter the records. The result becomes wrong if I set a "Country" slicer. That means it only works on "createdate". Attached the pbix if you are avaliable to take a look. Thanks!
- Ashish_Mathur1 year ago
Super User
Share the download link of the PBI file. Show the problem there very clearly.
- ssab_wenx1 year agoFrequent Visitor
Hi Ashish, I cannot upload the PBI file here since I am not a super user. Could you tell me your mail ? Really thanks!