I have a table that contains comma-separated values and single values in a column (text data type).
I do transformations and make a unique list of all single values and comma-separated values. When I click on the slicer and select any value it shows only one single valued row, not including comma-separated value rows.
Here is my Dataset:
Name Fax Phone Email Comments
----- ----- ------ ------ --------
Ravi 401852 258525 hi Email missing
Raju 754569 gsk#protonmail.com fax missing
Reetu 475875 Email Missing, Phone Missing
Heera Fax Missing, Phone Missng, Email Missing
naidu naidu#company.com Fax missing, Phone Missing
Now I am doing transformation on comments and making a unique list like the below by taking a reference from this dataset.
Email Missing
Fax Missing
Phone Missing
I am using this unique list in my slicer to filter the data in a table. But it doesn't fulfill my requirement.
It missing the CSV values and display only single values.
Example:
When I select "fax Missing" from the slicer, it shows only
Raju 754569 gsk#protonmail.com fax missing
But I required all the records including comma-separated ones, i.e. I expected the records of Raju, heera and naidu to display.
You can use the following measure to filter the fact using unique values from the slicer.
Measure =
VAR _isfiltered =
ISFILTERED ( Slicer[Slicer.Value] )
VAR _count =
CALCULATE (
COUNT ( 'Fact'[Fact.Comments] ),
FILTER (
VALUES ( 'Fact'[Fact.Comments] ),
CONTAINSSTRING ( 'Fact'[Fact.Comments], SELECTEDVALUE ( Slicer[Slicer.Value] ) )
)
)
RETURN
IF ( _isfiltered == TRUE, _count, 0 )
_isfiltered ensures that false is returned when nothing is selected.
CONTAINSSTRING reads through the comma-separated values.
Finally, results are returned as long as there is a selection.
Related
I am trying to create a filter for target table having country code column. I want to give access to people with logged in upn either in AdditionalOwner or OwnerEmail with countrycode
AdditionalOwner has emails separated by commas, Number of emails in additionalowner column is not fixed also it may have values from OwnerEmail column. So Please help me in giving RLS in this scenario
Please find my column structure
CountryCode
AdditionalOwner
OwnerEmail
AU
test1#test.com,test2#test.com
test2#test.com
Here is the DAX I have used for Owner Email
[Country Code] = LOOKUPVALUE(
UserRoles[CountryCode],
UserRoles[OwnerEmail],UserPrincipalName())
Please help me in adding RLS for AdditionalOwner column too
You may want to try using something like OR, IF, and CONTAINSSTRING in your managed role. I've included an example for you to test below. For transparency, I did not test this but this is where I would start to solve this.
OR (
UserRoles[CountryCode] =
IF(
CONTAINSSTRING ( UserRoles[AdditionalOwner], UserPrincipalName() )
, UserRoles[CountryCode], BLANK() )
, UserRoles[CountryCode] = LOOKUPVALUE(
UserRoles[CountryCode],
UserRoles[OwnerEmail], UserPrincipalName())
)
I have a big data table with a column called Account Name. In another table (Accounts) I have a column of Account Keywords that contains parts of full account names. I want to filter the big data by column 'Account Name' using the list of keywords in the 'Acount Keywords' list.
I've created a new measure in the big data table called 'Filter Accounts' with the following DAX:
FILTER ACCOUNTS = contains(Accounts,Accounts[Account Keyword],Big_Data[Account Name])
But the "contains" function works on exact matches. I want it to return true if the 'Account Keyword' is found within any part of the 'Account Name' field. I also want it to ignore case.
The DAX statement results in TRUE only for exact matches. How do I modify my DAX to achieve the desired non-exact matches?
DAX has two functions for text contains matching, CONTAINSSTRING and CONTAINSSTRINGEXACT, where the latter is case-sensitive but the former is not.
You can find how many keywords match an Account Name by writing a calculated column like this on the Big_Data table:
Keyword Matches =
COUNTROWS (
FILTER (
Accounts,
CONTAINSSTRING ( Big_Data[Account Name], Accounts[Account Keyword] )
)
)
To get a TRUE or FALSE output instead of a count, simply append > 0 to see if the count is a positive value.
Match Exists =
COUNTROWS (
FILTER (
Accounts,
CONTAINSSTRING ( Big_Data[Account Name], Accounts[Account Keyword] )
)
) > 0
I have around 7 fields coming from source. I need to pick the highest date of them all in an informatica expression. I may also get a default high date (12/31/9999) in any fields, but if that date shows up in any of the fields , then that has to be skipped in comparison.
e.g, if my source fields have data - 1/1/2001 , 1/2/2002, 2/2,2003, 12/31/999.
Then my expression output has to be 2/2/2003.
Create additional port that will discard the default, like
agg_Date = IIF(in_Date = '12/31/9999', NULL, in_Date)
Now use agg_Date in Aggregator Transformation to calculate MAX.
You can do it on SQ level ( custom sql query ) or Informatica level :
https://forgetcode.com/informatica/1472-greatest-find-greatest-value
Step 1:
Define check for each field ( or do it inline )
DATE_1_CHECKED = IIF( DATE_1 = TO_DATE('9999.. ', 'YYYY-' ), NULL, DATE_1)
Step 2:
GREATEST(DATE_1, DATE_2, DATE_3 )
ps. I'm not sure about casting function TO_DATE, please read doc.
ps. If You want to cut precission of date/time in informatica, please use trim(DATE_1, 'DD') to get date with HH24:MM:SS zero filled.
write an IIF to compare the date values using < , > and output the greatest one and !=12/31/999
I am trying to filter a table from Dynamics 365 by selecting a radio button which will update the table on the screen.
The user has three options to choose from: "School", "Business", "All".
When the user selects "All" then it should look in the "Accounts" table and search the "industrycode" column for blank values.
Below is a working Filter(), which returns the result I want
Filter(Accounts,industrycode = Blank())
However if I add an If() statement to it determine which value the user selected from the radio, I get an error that says the '=' symbol is an invalid argument type.
Filter(Accounts,industrycode = If("All" in radio_cust_type.Selected.Value,Blank()))
EDIT: When I want to check for a "School", I use a filter like:
Filter(Accounts,industrycode=If("School" in radio_cust_type.Selected.Value,34))
I intend to combine the two filters later but right now I want to check for blanks
This should work:
If(
radio_cust_type.Selected.Value="All", Filter(Accounts, industrycode = Blank()),
radio_cust_type.Selected.Value="School", Filter(Accounts, industrycode = 34),
radio_cust_type.Selected.Value="Business", Filter(Accounts, industrycode = XX)
)
Where XX is the industry code for "Business"
Problem
I'm trying to generate a table of distinct email addresses from multiple source tables. However, with the UNION statement on the outer part of the statement, it isn't generating a truly distinct list.
Code
Participants = UNION(DISTINCT('Registrations'[Email Address]), DISTINCT( 'EnteredTickets'[Email]))
*Note that while I'm starting with just two source tables, I need to expand this to 3 or 4 by the end of it.
A combination of using VALUES on the table selects plus wrapping the whole statement in one more DISTINCT did the trick:
Participants = DISTINCT(UNION(VALUES('Registrations'[Email Address]), VALUES( 'EnteredTickets'[Email])))
If you want a bridge table with unique values for all different tables, use DISTINCT instead of VALUES:
Participants =
FILTER (
DISTINCT (
UNION (
TOPN ( 0, ROW ("NiceEmail", "asdf") ), -- adds zero rows table with nice new column name
DISTINCT ( 'Registrations'[Email Address] ),
DISTINCT ( 'EnteredTickets'[Email] )
)
),
[NiceEmail] <> BLANK () -- removes all blank emails
)
DISTINCT AND VALUES may lead to different results. Essentially, using VALUES, you are likely to end up with (unwanted) blank value in your list.
Check this documentation:
https://learn.microsoft.com/en-us/dax/values-function-dax#related-functions
You might also like information under this link which you can use to get a specific column name for your table of distinct values:
DAX create empty table with specific column names and no rows