Forum Discussion
Dax help
Hi All,
I need small help in Dax please.. How do I rewrite this dax in correct way.. pls guide..
tpa removal rows = CALCULATE(COUNT('table1'[ID]),
FILTER('table1','table1'[Name]<>"*tpa*"),
FILTER('table1','table1'[Name]<>"tpa"),
FILTER('table1','table1'[Name]<>"*tpa"),
FILTER('table1','table1'[Name]<>"tpa*")
)
No I didnt undestand.. See this is how I used..
tpa removal rows = VAR __Result = CALCULATE ( COUNTROWS( 'table1' ), NOT 'table1'[Name] IN {"*tpa*", "tpa", "*tpa", "tpa*" } ) RETURN __ResultDid I used it correctly? Pls let me know, since I dont understand the syntax.. after countrows do I use table name or column name?
tpa removal rows = VAR __Result = CALCULATE ( COUNTROWS( 'table1' ), NOT 'table1'[Name] IN {"*tpa*", "tpa", "*tpa", "tpa*" } ) RETURN __Result= CALCULATE( COUNTROWS( Table1 ), NOT CONTAINSSTRING( Table1[Name], "tpa" ) )
9 Replies
- Greg_DecklerCommunity Champion
PowerBIBeginer You could do this:
tpa removal rows = VAR __Table = FILTER( 'table1', 'table1'[Name]<>"*tpa*" && 'table1'[Name]<>"tpa" && 'table1'[Name]<>"*tpa" && 'table1'[Name]<>"tpa*" ) VAR __Result = COUNTROWS( __Table ) RETURN __Result - parry2kSuper User
PowerBIBeginer or something like this:
tpa removal rows = VAR __Result = CALCULATE ( COUNTROWS( __Table ), NOT 'table1'[Name] IN {"*tpa*", "tpa", "*tpa", "tpa*" } ) RETURN __Result - parry2kSuper User
PowerBIBeginer table name
- ThxAlotSuper User
= CALCULATE( COUNTROWS( Table1 ), NOT CONTAINSSTRING( Table1[Name], "tpa" ) ) - PowerBIBeginerHelper V
Hi Greg, Hi Perry,
Thanks for such a quick and pretty soluton. But I dont understand
RETURN __Resultreturn __result is what? means in my case what will be there?
- parry2kSuper User
let's use the Name column in the table visual and then above measure, it will remove TPA rows.
- PowerBIBeginerHelper V
No I didnt undestand.. See this is how I used..
tpa removal rows = VAR __Result = CALCULATE ( COUNTROWS( 'table1' ), NOT 'table1'[Name] IN {"*tpa*", "tpa", "*tpa", "tpa*" } ) RETURN __Result- PowerBIBeginerHelper V
Did I used it correctly? Pls let me know, since I dont understand the syntax.. after countrows do I use table name or column name?
tpa removal rows = VAR __Result = CALCULATE ( COUNTROWS( 'table1' ), NOT 'table1'[Name] IN {"*tpa*", "tpa", "*tpa", "tpa*" } ) RETURN __Result
- parry2kSuper User
PowerBIBeginer I think it is worth asking what you are trying to achieve. Share sample data with the expected output. Read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490