As shown in images(link) that we have to count the no.of arrivals of a customer by cross checking with sessionStart. I need to represented the customer visits(count) based on the following trends: Once Every 3 Months / Once A Month / Once A Week / More Than Once A Week by using date field or (Session Start and Session End)?
Table name EDW_KLOUDSPOT_TXS
Power Bi visual
Related
I created a calculated table based on start and end dates to check which manager is responsible for a product per date.
Result:
The financial department uses a four week period to report. So 13 periods per year.
(not usable in a date table?)
Product number 8098 gets a different manager on the 23rd of januari this year.
So at the start manager C5104 is responsible and at the end of period one (202301) C5107 is responsible.
To get one responsible manager per period I'd like to filter the table in such a fashion that I get the numbers from the last date in a period. After filtering I don't need the [date] field anymore.
I hope I'm just missing something basic like the 'ELLEXCEPT' But I'm lost...
DISTINCT gives:
One row too many. I'd like to lose the row: 8098, C5104, 202301.
To keep only rows showing the manager per product at the end of a period.
Context: I have an dataset of Orders in quicksight, that is joined with Customer data. Because a Customer can have more than one Order the Customer data is duplicated and needs to be deduped.
I need to do an analysis of the number of days it took from the Customer to register (customer_date_added) to their first order (min(order_date_added)) and then bucket/group the results based on customer_date_added with different granularities of the date.
This is what I currently have working (6 visuals corresponding to the built-in date granularities in quicksight: year, quarter, month, week, day, hour)
*Visual 1* - x-axis:customer_date_added (aggregate year), y-axis:
ifelse(dateDiff(customer_date_added, min(order_date_added)) < 365, 1, 0)
*Visual 2* - x-axis:customer_date_added (aggregate quarter), y-axis:
ifelse(dateDiff(customer_date_added, min(order_date_added)) < 90, 1, 0)
*Visual 3* - x-axis:customer_date_added (aggregate month), y-axis:
ifelse(dateDiff(customer_date_added, min(order_date_added)) < 30, 1, 0)
*Visual 4* - x-axis:customer_date_added (aggregate week), y-axis:
ifelse(dateDiff(customer_date_added, min(order_date_added)) < 7, 1, 0)
.... etc
Issue: I have a lot of these dateDiff with bucketing visuals (not just days to first order) so my field list is getting overrun with fields like customer_first_order_within_year, customer_first_order_within_quarter, customer_first_order_within_month, etc. Also rather than just have one visual where I can change the date_granularity from year to month I have to maintain 6 different visuals for each dateDiff analysis I want to to.
What I want: One visual with two calculated fields (new_customer_with_first_order, new_customer_no_first_order). When I change the data granularity on customer_date_added to a new date granularity, the new_customer_with_first_order automatically displays customers that were added in that time period AND with a first order within that time period. Conversely new_customer_no_first_order would display customers that were added in that time period AND did not have an order within that time period. new_customer_with_first_order + new_customer_no_first_order = new customers within that time period.
What I have tried: I am relatively new to quicksight and business intelligence tools, but have a pretty good grasp of SQL. I have tried to read up on Level Aware Aggregation, Window Functions. None of these give examples using dates or date granularity. This seems like it would be a popular type of analysis but maybe it's not possible yet?
https://stackoverflow.com/a/63064505/3412268
https://docs.aws.amazon.com/quicksight/latest/user/windowMax-function.html
https://docs.aws.amazon.com/quicksight/latest/user/countOver-function.html
https://docs.aws.amazon.com/quicksight/latest/user/level-aware-aggregations.html
Please help. I don't understand why I have 2 similar data models and one works but the other does not.
I have a fact table with a Calendar Key and data as granular by day by location. I have a calendar dimension table with a Calendar key, each individual date, and month/fiscal year definitions.
Measures are Rev = SUM(FactTable[RevColumn]) then Rev PY = CALCULATE([Rev], DATEADD(CalendarTable[Day_Date], -1, YEAR))
Model 1 in Power BI, when I apply date filters, Rev calculates the total revenue & Rev PY calculates last year's rev for same range. Even if I select all dates that are YTD (which is tedious)
Model 2 in Excel 2016 Power Query, when I apply a year filter, Rev calculates total revenue for YTD in Fiscal Year & Rev PY is blank.
I don't understand what is different and why it would even fail in the first place. Calculate is supposed to override the filter context of the current filters right?
Also: the only "Date" type columns are located in the calendar table so it's not possible for me to select the wrong table.
I ultimately had to ask a professor on Udemy.com. The solution is to mark you calendar dimension table as a "Date Table." Since I'm combining the 2 tables on a whole number field, the time intelligence functions only work when filtering with date columns.
By marking the Calendar table as the Date table, the time intelligence functions know to use any attributes from that table to filter down the date ranges and get and display the appropriate answer.
In Power Pivot view, click the "Design" ribbon, then click the "Date Table" button and the "Set Default" button after that.
This resolved all issues I had.
I have a report that takes sales data from a few tables. I want to add a field that will divide the total sales for the given month by the total number of business days in that same month. Is there a way I can calculate that in an expression? Do I need to create a new table in the database specifically for months and their number of business days? How should I go about this?
Thank you
Intuitively, I would say that you need a simple function and a table.
The table is to host the exceptions like Independence day, labor day, etc.
The function will get two parameters: Month and Year (I'm not providing any sample code since you haven't specified which language you are using).
It will then build a date as yyyy-mm-01 (meaning, first day of the month). If will then loop from 2 to 31 and:
Create a new date by adding the index of the loop to the initial date,
Check if the resulting date is still within the month,
Check if it is a working or not working day (e.g. Sunday),
Check if it is found within the table of exceptions.
If the created date passes all the above tests, you add 1 to the counter.
Though it might look complex, it is not and it will provide you the correct answer regardless of the month (e.g. Feb.) and the year (leap or not).
I have measure formula that takes a table and converts it to monthly count of distinct customers:
Active Publishers =
CALCULATE(
DISTINCTCOUNT( 'Net Revenue Data'[Publisher Name] ),
'Net Revenue Data'[Active Month] = 1)
Now, I would like to create a new formula that takes the Month-Over-Month (MoM) variance of this trend, like this:
This is the formula I attempted to get the net monthly change:
Net Change = 'Net Revenue Data'[Active Publishers] -
CALCULATE('Net Revenue Data'[Active Publishers],
PREVIOUSMONTH('Net Revenue Data'[Date (Month)]))
How can I create a measure that takes the monthly variance of the 'DistinctCountActiveMonths' measure?
I created an additional date table to relate to the revenue table's date column:
Date Table =
ADDCOLUMNS(CALENDAR("1/1/2000","12/31/2025"),"DateAsInteger",FORMAT([Date],"YYYYMDD"), "Year",YEAR([Date]), "MonthNumber",FORMAT([Date],"MM"),"YearMonthNumber",FORMAT([Date],"YYYY/MM"),"Ye arMonthShort",FORMAT([Date],"YYYY/mmm"),"MonthNameShort",FORMAT([Date],"mmm"),"MonthNameLong",FORMAT([Date],"mmmm"),"DayOfWeekNumber",WEEKDAY([Date]),"DayOfWeek",FORMAT([Date],"dddd"),"DayOfWeekShort",FORMAT([Date],"dddd"),"Quarter","Q"&FORMAT([Date],"Q"),"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" ))
Now I should be able to relate the two tables to create Month over Month variance.
PREVIOUSMONTH(), like all built-in time intelligence functions in DAX requires a proper date dimension with consecutive, non-repeating dates that span from January 1 of the first year you have data to December 31 of the last year you have data.
I am unsure, looking at the tags on your post whether you are using add-ins to Excel or the Power BI desktop program. If Excel, there is an option in the Power Pivot menu to 'Mark as date table', which you should always do in a Tabular model. If Power BI desktop, this functionality is not yet available, so you must create the relationship between your date dimension and fact table on the date field directly, and not on some surrogate key.
One solution to this problem requires 2 steps:
Create an intermediate calculated column that takes the last month's active publishers:
LM Active Pubs = CALCULATE([Active Pubs],DATEADD('Net Rev 09-14'[Date],-1,MONTH))
Subtract the current months "Active Pubs" from the last month's active publishers:
Change in Active Pubs = [Active Pubs]-[LM Active Pubs]