cube-js / cube

📊 Cube — The Semantic Layer for Building Data Applications
https://cube.dev
Other
17.94k stars 1.78k forks source link

Power BI and rolling windows #8600

Open kraft6 opened 2 months ago

kraft6 commented 2 months ago

I am testing with Power BI connecting to Cube Dev. I am having problems with the rolling windows and the amounts/calculations are not calculating correctly. With Power BI, I am not sure how to pass in the date range and granularity with the query? Do you have any thoughts or experience in this space. Below is what is in my yml file, I was following this example: https://cube.dev/docs/guides/recipes/data-modeling/period-over-period.

Previous month is always the same a current month. Is there a way I can just do this through SQL?

name: current_month_sum
sql: totalprice
type: sum
rolling_window:
trailing: 1 month
offset: end

name: previous_month_sum
sql: totalprice
type: sum
rolling_window:
trailing: 1 month
offset: start

name: month_over_month_ratio
sql: "{current_month_sum} / {previous_month_sum}"
type: number
kraft6 commented 2 months ago

Just wondering if is any status on this or work around??

igorlukanin commented 2 months ago

Hi @kraft6 👋

Are you testing a raw SQL API connection? In any case, I believe you just have to drag the time dimension (date column) to the filters page in Power BI.

igorlukanin commented 1 week ago

@kraft6 Did my advice help?