Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
I have a database as below and need to populate my client status as new or old. A client is considered as new if the 'date' and 'live date' are same. For rows 2 and 3, client is same however it has a new deal marked as -002. client 12303 is counted twice for data source B. I need to populate the second row as blank as it has already be counted once in row 2.
Client Status = IF('Table1'[Date] ='Table1'[Live_Date] , "New", )
How do i use distinct count?
Apologies for too many complications.
| Data source | date | Live_date | Deal ID | Client ID | Status I am getting | REQUIRED STATUS |
| A | 26-Oct | 01-Sep | A00034 | A00034 | old | old |
| B | 15-Oct | 15-Oct | 012302-001 | 12302 | new | new |
| B | 26-Oct | 26-Oct | 012302-002 | 12302 | new | old |
| A | 01-Sep | 01-sep | 102538-001 | 102538 | new | new |
| A | 26-Oct | 26-oct | 102538-002 | 102538 | new | old |
| B | 26-Oct | 01-Sep | 0928abc-01 | 0928abc | old | old |
| B | 26-Oct | 01-Sep | 0928abc-02 | 0928abc | old | old |
| A | 01-Sep | 01-Sep | 1856XYZ54 | 1856XYZ54 | new | new |
Solved! Go to Solution.
assuming the deals are done in chronogical order you could then rephrase the logic to
for a given customer, if the Table1[date] is equal to the the Table1[Live_date] of the first deal made for that customer then new
which corresponds to this code
Status =
VAR CurrentCustomer = Table1[Client ID]
VAR CurrentDate = Table1[Live_date]
VAR FirstDealDate =
CALCULATE (
MIN ( Table1[Live_date] ),
FILTER ( Table1, Table1[Client ID] = CurrentCustomer )
)
RETURN
IF ( Table1[date] = FirstDealDate, "new", "old" )
which gives your expected output
assuming the deals are done in chronogical order you could then rephrase the logic to
for a given customer, if the Table1[date] is equal to the the Table1[Live_date] of the first deal made for that customer then new
which corresponds to this code
Status =
VAR CurrentCustomer = Table1[Client ID]
VAR CurrentDate = Table1[Live_date]
VAR FirstDealDate =
CALCULATE (
MIN ( Table1[Live_date] ),
FILTER ( Table1, Table1[Client ID] = CurrentCustomer )
)
RETURN
IF ( Table1[date] = FirstDealDate, "new", "old" )
which gives your expected output
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 37 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 25 |