what is the DAX equivalent of COUNTIFS - reporting-services

I'm new to power BI and trying to create a new column similar to this formula in excel:
=**IF(COUNTIFS(D:D,[#[FIVE9_AGENT_NM]],E:E,[#[FIVE9_CALL_SKILL]],C:C,[#[FIVE9_ANI]],H:H,"<"&[#[Date & Time]],H:H,">="&[#[Date & Time]]-5),0,1)**
Im stuck at this point not knowing how to convert the column to refer the row cell in the countif formula for example =COUNTIFs(H:H,H2,A:A,A4) would be easy to achieve in excel not sure now to reference the a cell in powerBi.
I have a table
Call_Dt| Five9_CALL_TIME| FIVE9_ANI| FIVE9_AGENT_NM| FIVE9_CALL_SKILL
_______|________________|__________|_______________|_________________
8/28/19| 12:23:07 |222333777 | JOHN | Billing
I want to create a new column which counts the records having the criteria n the excel formula above.
Any help on this will be greatly appreciated.
Thanks in advance!

Use CALCULATE along with FILTER:
Measure =
CALCULATE(
COUNT([column]).
FILTER(
[table],
//your filter conditions
)
)
Find more about these functions here: Calculate, Filter

Related

Try to have the Month and the day two digit in Sql

I have a StoredProcedure for Project table I want to select "ProjectStartDate" with format MMDDYYYY -> 07092021 and the data is going to print on an Excel spread sheet.
The code that I wrote is:
select
replace(convert(varchar, pp.ProjectStartDate,110),'-','')
from Project pp
But on the spread sheet the Month is 1 digit 7092021.
Please advice, Thank you
In MySQL you can use
date_format(ProjectStartDate,'%m%d%Y')

Migrating Measures and calculated columns from Tableau to PowerBi

Stuck at a specific measure calculation which looks like this in tableau
1.) zn(COUNTD(if not isnull([Order_number]) then [Order_number] END)).
I tried using isblank dax function but it is not working as i expected it to be.
How will the same measure be written in Powerbi using DAX?
Problem 2
Simultaneously, not able to get the output for a particular calculated column in powerbi for which the tableau query to derive that particular column looks like this:
2.) zn(IF CONTAINS([Record Type],"High") and datename('weekday',[Activity Date]) = 'Sunday' AND [Location] = '08520' THEN 7 ELSEIF CONTAINS([Record Type],"Junior") and datename('weekday',[Activity Date]) = 'Sunday' AND [Location] = '8520' THEN 7 end
I re created the above by Creating a custom column named it as Day Name deriving day name from the date column and Wrote an equivalent query in Powerbi query editor to create a custom column, query mentioned below. Even though there is no syntax error, it is giving 0 for all the rows in that particular calculated column.
slots= if([RECORD_TYPE]="high" and [Day Name]="Sunday" and [LOCATION]=08520) then 7 else
if([RECORD_TYPE]="Outbound" and [Day Name]="Sunday" and [LOCATION]=3109) then 7 else 0
Any kind of lead or help will be much appreciated.
Thanks in advance
For 1st problem:
zn(COUNTD(if not isnull([Order_number]) then [Order_number] END))
So, If i break this query basically, zn is a function used in tableau to convert all the null values to zero and as countd implies to the entire if statement above.
I was able to write an equivalent dax query for it mentioned below, if anyone out there can tell me or verify if it is correct or not, I'll be really thankful.
IF(ISBLANK(DISTINCTCOUNT(Order_table[ORDER_NUMBER])),0,DISTINCTCOUNT(Order_table[ORDER_NUMBER]))
As far as the second problem goes, im not able to find a solution to it and the value for that column for all the rows stands at 0 as I'm writing this answer to 1st problem. Any kind of help or lead will be much appreciated.
Thanks

SSRS CountIf Formula Equivalent to achieve distinct count based on value

I'm trying to find an equivalent formula that is like COUNTIF in Excel in SSRS to achieve a distinct cound based on a change in value,
For example below I can achieve this numbering for Line Number in Excel by using the following formula; =COUNTIF($A$2:A2, A2)
Excel example - click here
Any ideas how you can do this in SSRS?
Thanks heaps!!
Thank you for this, however it isn't giving me what I was hoping to achieve.
This is the result that I get using the following formula, I just get a value of 1 in each row.
=CountDistinct(Fields!INVOICE_NUMBER.Value)
Image of results of adding formula in SSRS
This image below is what I am trying to ultimately achieve, in Excel I can achieve this by;
=COUNTIF($C$2:C2, C2)
Image of results of adding formula
Any suggestions, Thanks!!
if you want to count with a condition you can use
=Sum(IIF(Fields!YourConditionField.Value = "NotBlue", Nothing, 1))
If you just want to count distinct values (every value just once) you can use
=CountDistinct(Fields!YourCountField.Value)
Instead of doing in ssrs try to change dataset by using row_number
like this - row_number() over(partition by INVOICE_NUMBER order by
INVOICE_NUMBER asc) as rownum

SSRS IIF Expression across Multiple DataSets

I'm trying to do an IIF expression on a 2nd dataset to sum the 'BookingsComfirmed2016LASTWEEK' column and then divide it by the sum of the 'Stock2016Week' column in the dataset I'm in and where the PropertyTypeCategory = Cottage, but with no joy. I'm sure it's something to do with the placement of the 2nd dataset name, but would appreciate any help. Regards Claire
Dataset1 = TradingLastWeekandYTD
Dataset2 = TradinglastWeekandYTDSTOCK
=(IIF(Fields!PropertyTypeCategory.Value, "TradingLastWeekandYTD" = "Cottage",Sum(Fields!BookingsConfirmed2016LASTWEEK.Value, "TradingLastWeekandYTD")) /(IIF(Fields!PropertyTypeCategory.Value = "Cottage", Sum(Fields!Stock2016Week.Value)),0)
Your iif() won't work like this.
You can't check row by row in a dataset you're not currently working in, which is what you are trying to do with the first part of the iif().
You can use custom code to do an aggregated lookupset() to get the values of the first part.
This link https://itsalocke.com/aggregate-on-a-lookup-in-ssrs/ will help you do the custom code.
For the lookupset(), you would have to do something like..
=Code.SumLookup(lookupset(Fields!PropertyTypeCategory.Value, "Cottage", Fields!BookingsConfirmed2016LASTWEEK.Value))
This assumes that your custom code function is called "SumLookup". It will sum all the values that the lookupset() returns.

SAP Web Intelligence - Summary Column Based on Multiple Criteria

I'm new to SAP Web Intelligence and I'm trying to create a report with a summary column based on multiple criteria. Below is my desired output in Excel as an example. I am having trouble coming up with ways to create this summary column (col H)
Link to the example here.
Essentially, I need column H to do the following:
Score = 0
For each cell in Range C:G, if cell isn't empty, get amount of points test is worth based on region the user is in, and add that score to "Score", and show in Column H as a total at the end.
Is this possible in SAP WI? I really really appreciate any help with this (even a push in the right direction).
Thanks!
I believe you're looking for a compounded IF function in a Variable here.
If you're used to using Excel, you will recognise the similar syntax for it:
=IF(TEST;Value if true;Value if false)
You will want to compound that so that you have and IF based on the 'Region' followed by a list of IF statements for each test that add up the points, followed by another list of IF statements for each test based on the other 'Region'
Something like the following should give you the basic start:
=If([Region]="Oceania";If(IsNull([Test #1]);0;1)+If(IsNull([Test #2]);0;1)+IF(...);If(IsNull([Test #1]);0;2)+If(IsNull([Test #2]);0;0.5)+IF(...))
From there you add the relevant test columns into the sums to get the totals for each row.