Datastudio: Blended Data: Date aggregation not working - google-data-studio

I have a blended data source, that connects two filtered Google Analytics metrics. In there I have a calculated chart field, that gives me the ratio between these two filtered metrics. Now I'm trying to change the date aggregation to year-month, but there seems to be a problem.
This is with date auto, which is perfect:
However this is what happens with Year Month aggregation:
There should be only a line per month left, but somehow the aggregation is not working.
Do you have any idea on how to fix this? I've setup my blended data source at least 10 times trying to use the date on one source or as a key, but none worked.
Cheers
Andreas

I didn't find a fix either. Worked around it by making a custom field with the function MONTH(date) and using that. Works like a charm
Your solution did the job perfectly. Thank you, Joppe. I am quoting your workaround as an answer to bring more visibility to it.
Credit: Joppe De Cuyper (comment in the question)

Best solution here :
https://support.google.com/looker-studio/thread/96504295?hl=en
I have found others with a similar issue
https://support.google.com/datastudio/thread/65220021?hl=en
The workaround I guess is to maybe have dedicated column that represents date month in your source data. So 01-01-2021 for all Jan 2021, etc. As long as they are the same it should work I think.
WORKAROUND
You can use the following Formula and add a calculated field to your source table:
DATE(YEAR(your_date_column),MONTH(your_date_column),1)
Last edited Feb 3, 2021

Related

Comparation Periods in Google Data Studio

I'm creating a in google data studio that has a table behind with data by day.
I need it to be comparable with the month before, but there's a catch that I'm currently stuck!
The period should be something like:
DAY(date)/MONTH(date)-1/YEAR(date)
This allows the comparation between periods with different number of days, example:
Date of analysis: 28/06/2021 - 27/07/2021
Date of comparation: 28/05/2021 - 27/06/2021
When trying to create something like this in DataStudio (with date range controls) none of the options does this, and for what I've explored, there isn't an option to do a formula like the one above.
The closest I get is "Previous Period" but that makes the Date of Comparation 29/05/2021 - 27/06/2021, missing the 28/05/2021.
I'm really stuck and running out of ideas, I've even considered changing the SQL query behind to convert the days somehow.
I've done this by mocking the dates for the comparator.
The other way is to create two series, and don't use the comparator.
Series #1 will have label 28/06/2021 and data from 28/06/2021 (current period).
Series #2 will have label 28/06/2021 (the same) and data from 28/05/2021 (previous period).
They plot nicely:

Google Data Studio apparently bugging year sorting in combined data sources

I have a combined data source that seems to work fine when I sort a bar chart using any metric.
However, as you can notice, the years are not in correct order.
When I select sorting ("Classificar") as year ("Ano") it bugs.
I noticed it is classifying "Ano" in the sorting area as a metric, but as a matter of facts thats a dimension. I didn't manage to find a way to change that.
About the data:
Ano is years in XXXX format
Receita LĂ­quida is Net Revenues in number format
Am I doing something wrong or that's a data studio bug and there is nothing we can do?
Unfortunately, not using combined data sources is not an option in this case (but when I cancel the combined data sources, it works fine and sorts by the year as it should be - still as a metric but it works).
Well, no one answered and I finally found a way to solve it.
Google Data Studio is indeed bugging the year sorting. However it only happens if year is a date object or a number. I fixed it when I turned it into text.

Excel IF Function Query - Dates

I am looking for some help regarding an IF function on an Excel document.
Basically if the Date Listed cell is dated over 1 month ago (eg: Date Listed 6-Aug but today is 6-Sep) and the Date Sold cell is blank, then I would like the Mark Down cell to say 'MARK DOWN', which at the moment it does but it is only 10-Aug today.
If the Date Listed cell and the Date Sold cell both contain dates I would like the Mark Down cell to say 'OK'.
So far I have this written:
=IF(AND(DATE(YEAR(G2),MONTH(G2),DAY(G2)), ISBLANK(H2)),"MARK DOWN","OK")
I know I'm not far off but I need help sorting out the last parts..
Bonus if you can help me add a highlighted cell formatting to it :)!
[EXAMPLE IMAGE]
I think this should work
IF(AND((TODAY()-g2)>31,ISBLANK(H2)),"Mark Down","OK")
Apply conditional formatting on all the cells in MARK DOWN column which are equal to OK.
After that write this simple formula to check the condition.
=IF(AND(ISNUMBER(G2),ISNUMBER(H2)),"OK","MARK DOWN")
Update: if you use EDATE function everything gets simplified as this function takes care of exact day differences
so the whole solution is :
=IF(AND(EDATE((G2),1)=EDATE(NOW(),0),ISBLANK(H2)),"MarkDown","")
Let me know if you have any question on how this formula works.

Creating custom rollups with SSAS

I am currently working on a requirement as follows and would appreciate some help in figuring out a way to configure the aggregation of my measure:
I have a fact table that contains the following Item ID, DateID,StoreID, ReceivedComments. The way received comments work is that on a daily basis a new record is created that adds to the value of received comments (for example if Item 5 in Store 5 on 1 Jan had 23 Received Comments and it received 5 comments the following day, the row for Jan 2 would be Item 5, Store 5, Jan 2, 28)
We created a measure using MAX and it works fine whenever Item ID is used in the query. When we start moving to a higher level the max produces wrong results. Our requirement is to setup the measure to be as follows:
If the member selected is on the Item Level then MAX, if it's on any other level (Date or Store) then the measure should aggregate the Max of all Items under this date or store.
Due to the business rules and structure of the database Store and Item are different dimensions so I can not include them in 1 Hierarchy.
We have been playing around with Custom RollUps but so far haven't been able to get it to work.
Thanks
I would solve this by using a more traditional approach to your fact table. Instead of keeping a cumulative count in the ReceivedComments column, I would keep only the number of comments received THAT DAY.
That way, instead of using MAX, you can create your measure using SUM, and it will automatically rollup when you go to higher levels.
The only disadvantage I can see to this approach is that you will need to use a range of dates, instead of only the most recent date, to get a full total of all the comments for a given item/store/date. But that's a very small change to your MDX.
Someone suggested using ISLEAF to determine the level, Instead of using ISLeaf i went with AS CASE WHEN [Item].[ItemID].CURRENTMEMBER.LEVEL IS [Item].[ItemID].[(All)] so I don't have to account for other dimensions such as Date, Store, etc as I have several other dimensions that all behave the same way.
And then I went with this formula to determine the Sum of the Max of the items in a particular store like this:
SUM({[Item].[Item ID].children},[Measures].[ReceivedComments]), Now I expect some performance issues with this measure but we are currently running some tests to see if it's gonna be reliable to work with it on actual data.

How can I aggregate date data with EntityFramework but without skipping entries with no data?

How can I aggregate data by week with EntityFramework but without skipping weeks for which there is no data? So, basically if there is no data for given week - I want to get 0 or NULL as a result for that week.
Agreeing with Luke's comment above, if you know the weeks included in the search, can you just push your results onto a pre-filled week->result Map of some type initialized to zero?
A quick google shows this smarter than me guy likes this answer too:
http://thenullreference.com/blog/analytical-queries-using-entity-framework-over-date-ranges-using-linq/

Resources