Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello Power BI Team,
The data I have presented is all on the same table. I want to create a column that identifies if the record is unique based on the Latest Cteated_Date, Customer Name, Agent Name.
I believe I can use the Earlier Function but I am not sure how to do it. Can you help?
The table below is the results I am trying to achieve
Case Customer Name Latest Created_Date Agent Name Agent Location Unique Record
114935437 | LOKI | 11/17/2020 17:35 | Capt America | Avengers Tower | 1 |
114935438 | LOKI | 11/17/2020 17:35 | Capt America | Avengers Tower | |
114935439 | LOKI | 11/17/2020 17:35 | Capt America | Avengers Tower | |
114935440 | LOKI | 11/17/2020 17:35 | Capt America | Avengers Tower | |
114935441 | LOKI | 11/17/2020 17:35 | Capt America | Avengers Tower | |
114935442 | LOKI | 11/17/2020 17:35 | Capt America | Avengers Tower | |
114935443 | LOKI | 11/17/2020 17:35 | Capt America | Avengers Tower | |
114935444 | LOKI | 11/17/2020 17:35 | Capt America | Avengers Tower | |
110759610 | THANOS | 9/8/2020 19:37 | Apil O'Neal | New York | 1 |
110759789 | THANOS | 9/8/2020 19:39 | Apil O'Neal | New York | 1 |
111084676 | ULTRON | 9/14/2020 13:38 | HULK | Avengers Tower | 1 |
111084966 | THANOS | 9/14/2020 13:40 | HULK | Avengers Tower | 1 |
111233012 | THANOS | 9/15/2020 20:06 | HULK | Avengers Tower | 1 |
111233013 | THANOS | 9/15/2020 20:06 | HULK | Avengers Tower | |
111233014 | THANOS | 9/15/2020 20:06 | HULK | Avengers Tower | |
111688380 | THANOS | 9/23/2020 13:25 | Peter Parker | Avengers Tower | 1 |
111742935 | THANOS | 9/23/2020 19:56 | Peter Parker | Avengers Tower | 1 |
111743168 | THANOS | 9/23/2020 19:58 | Peter Parker | Avengers Tower | 1 |
111743330 | THANOS | 9/23/2020 19:59 | Peter Parker | Avengers Tower | 1 |
111851971 | THANOS | 9/25/2020 13:19 | Dr. Strange | Multiverse | 1 |
111851972 | THANOS | 9/25/2020 13:19 | Dr. Strange | Multiverse | |
111851973 | THANOS | 9/25/2020 13:19 | Dr. Strange | Multiverse | |
111851974 | THANOS | 9/25/2020 13:19 | Dr. Strange | Multiverse | |
111851975 | THANOS | 9/25/2020 13:19 | Dr. Strange | Multiverse | |
111986026 | THANOS | 9/28/2020 21:26 | Peter Parker | Avengers Tower | |
112068538 | THANOS | 9/30/2020 15:30 | Falcon | Avengers Tower | 1 |
112068539 | THANOS | 9/30/2020 15:30 | Falcon | Avengers Tower | |
112068540 | THANOS | 9/30/2020 15:30 | Falcon | Avengers Tower | |
112068687 | THANOS | 9/30/2020 15:32 | Falcon | Avengers Tower | 1 |
112859127 | THANOS | 10/12/2020 19:49 | Janet Van Dyne | Avengers Tower | 1 |
113033489 | THANOS | 10/14/2020 21:27 | Janet Van Dyne | Avengers Tower | 1 |
113143196 | THANOS | 10/16/2020 15:38 | Janet Van Dyne | Avengers Tower | 1 |
113312513 | THANOS | 10/20/2020 15:37 | Wanda Vision | Avengers Tower | 1 |
113312514 | THANOS | 10/20/2020 15:37 | Wanda Vision | Avengers Tower | |
113312515 | THANOS | 10/20/2020 15:37 | Wanda Vision | Avengers Tower | |
113312516 | THANOS | 10/20/2020 15:37 | Wanda Vision | Avengers Tower | |
113312517 | THANOS | 10/20/2020 15:37 | Wanda Vision | Avengers Tower | |
113312518 | THANOS | 10/20/2020 15:37 | Wanda Vision | Avengers Tower | |
113312519 | THANOS | 10/20/2020 15:37 | Wanda Vision | Avengers Tower | |
113483912 | THANOS | 10/22/2020 16:43 | Tony Stark | Avengers Tower | 1 |
113483913 | THANOS | 10/22/2020 16:43 | Tony Stark | Avengers Tower | |
113483914 | THANOS | 10/22/2020 16:43 | Tony Stark | Avengers Tower | |
114032879 | THANOS | 11/2/2020 15:34 | Capt Marvel | Avengers Tower | 1 |
114032880 | THANOS | 11/2/2020 15:34 | Capt Marvel | Avengers Tower | |
114032881 | THANOS | 11/2/2020 15:34 | Capt Marvel | Avengers Tower | |
114032882 | THANOS | 11/2/2020 15:34 | Capt Marvel | Avengers Tower | |
114032883 | THANOS | 11/2/2020 15:34 | Capt Marvel | Avengers Tower | |
114032884 | THANOS | 11/2/2020 15:34 | Capt Marvel | Avengers Tower | |
114032885 | THANOS | 11/2/2020 15:34 | Capt Marvel | Avengers Tower | |
114212338 | THANOS | 11/4/2020 16:49 | Winnie La Pooh | Disney | 1 |
114414888 | THANOS | 11/7/2020 14:53 | Janet Van Dyne | Avengers Tower | 1 |
114840350 | THANOS | 11/16/2020 16:22 | Groot | Planet Nova | |
114840725 | THANOS | 11/16/2020 16:24 | Groot | Planet Nova | |
114840726 | THANOS | 11/16/2020 16:24 | Groot | Planet Nova | |
114840727 | THANOS | 11/16/2020 16:24 | Groot | Planet Nova |
Solved! Go to Solution.
Hi @Jorgast
Try this.
Unique record V1 =
VAR isUnique_ =
CALCULATE (
COUNT ( Table1[Case] ),
ALLEXCEPT (
Table1,
Table1[Customer Name],
Table1[Latest Created_Date],
Table1[Agent Name]
)
) = 1
RETURN
IF (
isUnique_,
1,
VAR minCase_ =
CALCULATE (
MIN ( Table1[Case] ),
ALLEXCEPT (
Table1,
Table1[Customer Name],
Table1[Latest Created_Date],
Table1[Agent Name]
)
)
RETURN
IF ( minCase_ = Table1[Case], 1 )
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi @Jorgast
Try this.
Unique record V1 =
VAR isUnique_ =
CALCULATE (
COUNT ( Table1[Case] ),
ALLEXCEPT (
Table1,
Table1[Customer Name],
Table1[Latest Created_Date],
Table1[Agent Name]
)
) = 1
RETURN
IF (
isUnique_,
1,
VAR minCase_ =
CALCULATE (
MIN ( Table1[Case] ),
ALLEXCEPT (
Table1,
Table1[Customer Name],
Table1[Latest Created_Date],
Table1[Agent Name]
)
)
RETURN
IF ( minCase_ = Table1[Case], 1 )
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
@Jorgast Are your desired results in the unique column what you're looking for? I get different results when I calculate, but this is the DAX for new column that will identify unique values based on those three columns:
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Thank you for your response. When I add your code it shows me all the unique values. In the case where Agent name, Case date, agent name are all the same the data shows blank. I need it to show 1 record is unique as well.
i apologize for not being clear on what I am trying to accomplish
@Jorgast That's fine, you're looking for distinct count then. Does this need to be as a calculated column in this case? You can use the DISTINCTCOUNT function in a measure perhaps?
If you want as a column, try:
Distinct = IF(COUNTROWS(FILTER(ALL(CaseTable), CaseTable[Case Record]<=EARLIER(CaseTable[Case Record]) && CaseTable[Customer Name]= EARLIER(CaseTable[Customer Name]) && CaseTable[Latest Created_Date] = EARLIER(CaseTable[Latest Created_Date]) && CaseTable[Agent Name]= EARLIER(CaseTable[Agent Name])))=1, 1)
Unique = IF(COUNTROWS(FILTER(ALL(CaseTable), CaseTable[Customer Name]= EARLIER(CaseTable[Customer Name]) && CaseTable[Latest Created_Date] = EARLIER(CaseTable[Latest Created_Date]) && CaseTable[Agent Name]= EARLIER(CaseTable[Agent Name])))=1, 1)
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |