Powerbi - DAX: COUNT & GROUP BY - Count all coversation id's per Queue - powerbi

I've been struggling with the next one. I need to make the sum of every unqique conversation ID per Queue.
There are 2 Tables I would like to us: Query and Segment.
First attempt to use "Group By"
Total Answered Calls =
GROUPBY(segment;queue[name];"Total Answered"; COUNTX(CURRENTGROUP();COUNT(segment[conversationid])
))
I keep on recieving the error "The expression refers to multiple Columns [...] cannot be converted to scalar value.
Dit I use "Group B"y wrong or do I need another approach?
Many Thanks!

Well this did the trick.
Total Answered Calls = (SUMX(SUMMARIZE(segment; segment[queueid];"Total Answered"; [Calls Answered]);[Total Answered]))
Thanks anyway!

Related

Build a chart a field parameter chart with full display / topn

I have a field parameter containing 5 fields. I would like to build a chart where user can have full display (all values from field) or top10 if he wants to, ordered by CountOfItems
I try to build measure like
TOPN(10, SUMMARIZE(CategoryTable, CategoryTable[CategoryDescription], "#Count", [CountOfItems]), [#Count], DESC)
However I am getting an error that "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value." - how to overcome that? The second question is: will it apply also filters in a report to the top10 or just calculate solely top10 regardless of filters and put it into table/chart?
How to even approach such chart?
Thank you in advance
Your expression looks clean. The problem could be with your measure. Can you check/add code for [CountOfItems]? I'd try to use ADDCOLUMN + SUMMATIZE.
TOPN(
10
,ADDCOLUMNS(
SUMMARIZE(CategoryTable, CategoryTable[CategoryDescription])
,"#Count", [CountOfItems]
)
,[#Count]
,DESC
)
For the second question the answer - Yes, all filters will be applied.

How to replace missing values in panel data?

I am looking into weekly earnings data, where I have defined my data as pre-pandemic earning data and post-pandemic earning data. Now for some individuals, I have some missing values for the post-pandemic period which I want to replace with their pre-pandemic earnings. However, I am struggling with the coding for this panel data. I was hoping someone could help me with. Thanks in advance.
It is always easier if you share example data (see dataex) or at least list what variables you have. The example below will therefore most likely need to be edited.
* Sort the data by individual id and the time unit
* that indicates if this the obs is pre or post pandemic
sort id time
* This replaces the earnings value with a missing value if the
* id var is the same as on the next row AND the earnings var
* on is missing on the next row
replace earnings = . if id == id[_n+1] & missing(earnings[_n+1])
This assumes that all individuals are indeed represented in each time period and that you have a unique id variable (id) in your data set.

Power BI remove duplicates based on max value

I have 2 column; ID CODE, value
Remove duplicates function will remove the examples with the higher value and leave the lower one. Is there any way to remove the lower ones? The result I expected was like this.
I've tried Buffer Table function before but it doesn't work. Seems like Buffer Table just works with date-related data (newest-latest).
You could use SUMMARIZE which can be used similar to a SQL query that takes a MIN value for a column, grouped by some other column.
In the example below, MIN([value]) is taken, given a new column name "MinValue", which is grouped by IDCode. This should return the min value for each IDCode.
NewCalculatedTable =
SUMMARIZE(yourTablename, yourTablename[IDCode], "MinValue", MIN(yourTablename[value]) )
Alternatively, if you want the higher values just replace the MIN function with MAX.

How do I change the individual value to be summed during annotation in Django?

I am front end developer new to django. There is a certain column(server_reach) in our postgres DB which has values of (1,2). But I need to write a query which tells me if at least one of the filtered rows has a row with reachable values( 1= not reachable, 2 = reachable).
I was initially told that the values of the column would be (0,1) based on which I wrote this:
ServerAgent.objects.values('server').filter(
app_uuid_url=app.uuid_url,
trash=False
).annotate(serverreach=Sum('server_reach'))
The logic is simple that I fetch all the filtered rows and annotate them with the sum of the server_reaches. If this is more than zero then at least one entry is non-zero.
But the issue is that the actual DB has values (1,2). And this logic will not work anymore. I want to subtract the server_reach of each row by '1' before summing. I have tried F expressions as below
ServerAgent.objects.values('server').filter(
app_uuid_url=app.uuid_url,
trash=False
).annotate(serverreach=Sum(F('server_reach')-1))
But it throws the following error. Please help me getting this to work.
AttributeError: 'ExpressionNode' object has no attribute 'split'
Use Avg instead of Sum. If average value is greater than 1 then at least one row contains value of 2.

Sharepoint calculated column based on other columns #NULL! error

I am trying to add two currency columns in a calculated column but am getting a #NULL! error.
This seems pretty straightforward but its my first time doing this in SharePoint.
SharePoint 2010 with Excel Services available.
Have create List with required columns:
Approved Value column Type = Currency
Pending Value column Type = Currency
Total Value column
Calculated (calculation based on other columns)
Type = Currency
Formula: =[Approved Value]+[Pending Value]
The values in other columns are indeed currency, but the Total shows #NULL! for all items.
I can't see anything done incorrectly.
What should I be looking for to resolve this problem?
Try using the ISBLANK function to previously check if any of the value is null.
Reference: ISBLANK function
I ended up using NZ(Value, 0)
=NZ([Approved Value],0)+NZ([Pending Value],0)
Though not sure how NULLs ended up in field or why SharePoint couldn't deal with them without this special treatment.