Amazon Quicksight Calculated Fields - amazon-web-services

I'm having a problem with what should be a very simple calculated field. I have two conversion numbers, let's say a "7 day click" number and a "1 day view" number.
I'm trying to create a calculated field that simply adds these two numbers together.
Yet, this is the result I'm getting:
As we can see, the all conv value is not simply adding the other two columns. What am I doing wrong in the calculated field?
Thanks in advance, as I've spent way too much time trying to figure out such a simple thing
EDIT:
It appears that, when I add a new grouping, that the problem consists of null values in one of the two columns. example:
How can I change the calculated field to account for this? In the data warehouse, these blank values are just null values.
Thanks

I tried out what You did and it works fine for me:
QuickSight Table
Calculated field
I suppose there is something wrong with Your dataset.
Probably the granularity of the date field is not day but something else like hour and the calculated field tries to add eg. 11 Jun 10:00 + 12 Jun 11:00.
This is of course wrong. You need to add 11 Jun + 12 Jun.
Probably You need to extract the day of Yours date field.

to my question about the calculated field, this was what I used that worked.
ifelse( isNull({conv_1dv}), 0, {conv_1dv}) + ifelse(isNull({conv_7dc}),0,{conv_7dc})

Related

How do I create an Other category in PowerBI Desktop?

I am learning Power BI Desktop. I have a project already loaded for which I have created a
pie chart.
As you can see, the data is currently divided into two years: 2022 and 2021.
I also have data for previous years that I want to include in the chart. Unfortunately, none of these years has a high number. So I want to group them all into an "Other" category.
I've already tried using the RANKX function as described here (where I copied and pasted the formula from the comment and replaced the field name with my own) and here (where I went through the article step by step using my own field names). I used the exact format shown in both the comment and the article:
Rank = RANKX('Table','Table'[Percent],,DESC,Dense)
(Table is the table name I am using and Percent is the column I am trying to rank.)
When I added the new column to a table, though, PowerBI automatically gave me a sum calculation. This calculation gave me a 1 in each column. When I asked it not to give me a sum, it said it could not display the visual and took me back to the calculation screen.
EDIT: Thanks for your help Kevin! This is the table I tried to draw from. I am an idiot sometimes.
EDIT 2: Now I am trying to use a different field in the formula:
Rank = RANKX('FactClaimActivity','FactClaimActivity'[DirectIncurredLoss_ITD])
(This is the original field that I tried to base Percent on)
My table looks like this. (Yes, I know that 2016, 2017, 2019 and 2020 have negative values and 2014 and 2015 have $0 values. I just want to show what the data is.)
EDIT 3: This time I am also getting an error when I type in the formula, which says "A single value for column 'DirectIncurredLoss_ITD' in table 'FactClaimActivity' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."
I do not understand why it wants a single result for a formula that ranks the data points based on this field. That seems like it defeats the whole purpose of the formula.
Yet when I use the formula, I get the same result as last time! This column is in the Fixed decimal number format, and it does have many different values.
EDIT: I've found the answer
New Category = IF('FactClaimActivity'[Rank]<=2,'FactClaimActivity'[LossYear],"Other")
The formula will help you get the correct result.

'OR' Filtering on Columns in PowerBI

I've got an oddly set up google sheet as my data source for a powerBI dashboard. Right now my main stress point is a 'last 7 days' filter that needs to be applied. The problem is that there are multiple columns containing dates that could be in the last 7 days, in this case representing multiple steps in an email chain.
If any one of those columns contains a date in the last 7 days, then I need to capture the row in most of my visualizations and tables, but if I just use standard filters, PowerBI assumes 'AND' and displays none of the rows, since there will almost never be a row where multiple date entries are in the last 7 days.
I'm almost certain there is a way to do this with either merged columns or calculated fields, or maybe there is even something as simple as an 'OR' filter, but thus far my googling has not turned up anything. Do you know a work around for this?
Thanks in advance!
In Power Query Editor, create a duplicate column for each of your date fields.
Make sure each of the duplicated columns is in Date format and then calculate the "Age". You will get a time value. In the Transform pane, use the "Duration" function and convert to "Days". Do this for each of the duplicated columns.
Now the last step: Create a "conditional column" in the "Add column" pane, and pull all of these new columns that should now have integer values and set the condition to show "Yes" if less than or equal to 7, "No" if more than 7.
Let me know if this helps.

Need date hierarchy for a column, otherwise DATEADD doesn't work

so I am running a DAX query where I compare 2 date columns (both have full date, no time included) and need to figure out, whether one is still valid (within range), if I add 56 days to the other - using the DATEADD function for this.
It worked before, when I had the date hierarchy in the model, seems like Power BI only accepts .[Date] notation, meaning that
DATEADD(InvoiceDueDate; 56; DAY)
won't work, but
DATEADD(InvoiceDueDate.[Date]; 56; DAY)
will work.
Still, I needed to manage relationship model in the data model and I ended up with date hierarchy lost for this column and to use it with .[Date] won't work now.
What are my options now, is there a way to return back the date hierarchy for a column? I tried googling this but came empty handed, there are results, but not entirely valid for my problem. Also DATEADD should obviously work with date column since it is a column of data type Date, but it doesn't. Would be so thankful for any help here. Thanks a lot!
Not a solution but a workaround:
InvoiceDueDate + 56
You can simply avoid using DATEADD if you don't need to add intervals other than day.

PowerBI: Last 3 Non Blank Values from column

I have a table where I get the status of the employees tasks day by day.
As in below image I get the values(Confidential, so just entered dummy data).
Then I did unpivoted the dates column and made a copy of that and split with space so that I can get the date value.
Here I would like to show the last 3 commented values in a table visualization for each task.
Like as in above image, if the 5/31/2017 value is not available, then it should get the values of 5/29/2017 plan, 5/29/2017 actual, 5/30/2017 plan values i.e nothing but the last 3 non blank values.
Any suggestions please.
Mohan V
I think i got the solution.
I did mentioned in Top N filtering of visual level filter of fields.
And it worked for me.
Thanks for the hint #user5226582

Merging data with a dates table gives strange behaviour when some recordfield is added

I'm using Crystel Reports again after not touching it for about 8 years.
I'm having this situation...
I have 1 data table, and 1 table with just day numbers from 1 to 31.
Nothing is really linked between each other.
In my report I let the user select a reference date.
From that date I grab the maximum days of the month.
The report lists a row per day of that month but there are no actual database fields inthere. Just the first 2 letters of the dayname, the day number and another formula based field showing 'yes/no' or '' depending on a main record value.
So far so good.
In the group header I was adding the fields from the main datatable which went all fine until I added fields that in the query on the sql server rely on some cases but CR just read it out as 1 singe record row with everything in it.
For some reason the report generation goes from 1-2 seconds to 30-40 once I add that field that just outputs 'X' or ''. (it represents things assigned to that user)
Other reports where I'm using the same data still generate in 2 seconds.
To get this working right and to eleminate double date records I'm stuck with 3 groups.
I think this ain't optimal and the reason for the slow down although it wasn't there at the start.
So I was wondering:
Should I go for a sub report for the day listing?
Can I feed the subreport with my date parameter?
or is there some kind of scripted way to list a row x-times without all the grouping requirements?
Synchro was right, the problem was in the actual query/view.
For some reason the view takes half a minute longer if you just added an order by to a specific field.
The "where id between 211 and 265 or id=67" has been moved from a joined view to the actual query.
Thanks for the hint, Synchro.