What's the equivalent function on Quicksight like "Countifs" on Excel? I would like to create a calculated field to add the count if Order status = Created AND Order status = Paid. What would be the syntax? Many thanks in advance!
Order status
Count
Created
45
Paid
50
Closed
10
You can do
countIf({Count}, {Order status} = "Created" OR {Order status} = "Paid")
https://docs.aws.amazon.com/quicksight/latest/user/countIf-function.html
Related
I am trying to recreate the following calculation from PowerBI in Tableau but I am not sure how to achieve what FILTER() function does.
(CALCULATE(SUM(Data[Amount]),FILTER(Data,Data[Paid]="True"))/SUM(Data[Amount]) +
CALCULATE(COUNT(Data[Document ID]),FILTER(Data,Data[Paid]="True"))/COUNT(Data[Document ID]))/2
My assumption was to use IF or CASE but then I couldn't figure out how to divide by number of all documents, regardless of their payment status.
I suppose you need the following:
SUM(IF [paid] = "True" then [Amount] end)/SUM([Amount])
+
COUNT(IF [paid] = "True" then [Document ID] end)/COUNT([Document ID])/2
The filter is specified using the if statement.
I am working with a bunch of data for my job creating status reports on the documents that we are working through that we then assign to an area. We decided to use PowerBI as an interactive way to see where everything is at.
Using Power BI Desktop I've created a new table that excludes documents that are not ready for QC but we have several different statuses. Instead of creating a new table for each status type (since some can be grouped together) I would like to create a new column that has the grouped status value's Max for each area. The higher the Status Value the further it is from being complete.
EX:
Record:
Area:
Status Value:
Max Status Value:
152385
A
1
2
354354
B
2
3
131322
B
3
3
132136
A
2
2
213513
A
1
2
351315
B
2
3
If anyone knows how to get the Max Status Value column that would greatly help. I did find another post (https://community.powerbi.com/t5/Desktop/LOOKUPVALUE-return-min-max-of-values-found/td-p/657534) that was similar but I'm still new to DAX and could not figure out how to apply it to my situation.
This post actually helped me answer the question.
https://community.powerbi.com/t5/Power-Query/Maxifs-Power-Query/m-p/1693606
The only difference I made was getting rid of the true/false portion to receive my results. Thus my result was:
Max Status Value =
VAR vMaxVal=
CALCULATE (
MAX ( 'Table'[Status Value] ),
ALLEXCEPT (
'Table',
'Table'[Area]
)
)
RETURN
vMaxVal
I have some problem to count total record using WHERE clause condition with pagination in Laravel.
Ex: I have total 100 records (female students = 40 and male student = 60) and display 10 records per page.
So I want to count total records of female student when display in homepage.
I have tried like this {{$StudentInfo->where("sex",1)->count()}} but it count record only in current page not all record and when I used total() it does not work {{$StudentInfo->where("sex",1)->total()}}.
Note: sex = 1 (female), sex = 0 (male).
Thanks.
{{$StudentInfo->where("sex",1)->get()->count()}}
Hope this works..
Do $StudentInfo->total();
Check the docs: https://laravel.com/docs/7.x/pagination
Hello Everyone can you please help me to resolve this
I want to get the user count day-wise, for example, I want to know how many users registers in last week
like date of
22-07-19
user count 20
23-07-19
user count 30
24-07-19
user count 10
25-07-19
user count 15
I want this result for last 7 day from today
basically, I want to show this in my chart please check the image here
By selecting DATE(created_at) and grouping by that, we can get the count of users that have registered each day. We can then add a simple where clause, using Carbon to help us get the lower bounds.
Example (where x = date and y = count):
User::selectRaw('DATE(created_at) as x, COUNT(*) as y')
->groupBy('x')
->where('created_at', '>', Carbon::now()->subWeek())
->get();
I am Trying to get all the invoices in a single API hit.
Because, for every user having 100's of invoices.
It will exceed the API limit (Minute Limit: 60 calls in a rolling 60 second window).
I am trying to store all the invoice id into a single array and from that i will get the details of the user and then i loop the records locally and display it. It's the right way?
invoice_ids = user.estimates.select("invoice_id") || [] xero = Xeroizer::PrivateApplication.new(XERO_CONFIG["key"], XERO_CONFIG["secret"], XERO_CONFIG["path"], :rate_limit_sleep => 5)
invoices = ['795f789b-5958-xxxx-yyyy-48436dbe7757','987g389b-5958-xxxx-yyyy-68636dbe5589']
inv_id = invoice_ids.pluck(:invoice_id)
invoices = xero.Invoice.all(:where => 'InvoiceID==inv_id')
Also, I am getting the following error:
Xeroizer::ApiException (QueryParseException: No property or field 'inv_id' exists in type 'Invoice')
Looks like the problem is that you're not interpolating the inv_ids correctly. You probably need to do something like this:
invoices = xero.Invoice.all(:where => "InvoiceID==\"#{inv_id}\"")
You may have to perform some additional formatting on the inv_id variable to make it a valid Xero string. https://github.com/waynerobinson/xeroizer#retrieving-data