Forum Discussion
Help needed with DAX
- Anonymous4 years ago
Anonymous
You can create a measure, if an ID is repeated show the count of the ID otherwise return 0.
CountIfRepeat = IF(COUNT([ID])>1,CALCULATE(COUNT('Table'[ID]),FILTER(ALL('Table'),[ID]=MAX([ID]))),0)Best regards
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
Anonymous Try:
# of Extensions =
VAR __Number = 'Table_Name'[Number]
VAR __Count = COUNTROWS(FILTER(ALL('Table_Name'),[Number]=__Number))
RETURN
SWITCH(TRUE(),
ISBLANK(__Number),BLANK(),
ISBLANK(__Count),0,
__Count
)- Greg_Deckler4 years agoCommunity Champion
Anonymous I'm confused as to you setup. Do you have a Name and Number column? Maybe something like:
# of Extensions = VAR __Number = 'Table_Name'[Number] VAR __Name = 'Table_Name'[Name] VAR __Count = COUNTROWS(FILTER(ALL('Table_Name'),[Name]=__Name)) RETURN SWITCH(TRUE(), ISBLANK(__Number),BLANK(), ISBLANK(__Count),0, __Count )Can you provide sample data as text to mock this up?
- Anonymous4 years agoNot applicable
I have a table with ID and Extension ID. I want to calculated how many times an extension was filed for each ID. If no extension is filed, then it should retun 0 else return the total number of extensions for each ID.
Firstly, I applied a conditional formatting in Power Query Editor - if Extension Id is blank, then it should return 0 else return ID (see the table)
In table visualization, I want the number of extensions for each ID. So, it should reflect something like this
I hope this sample is easier to understand. Any help would be appreciated. Thank you.
- Greg_Deckler4 years agoCommunity Champion
Anonymous Text data please.