Forum Discussion
prashantg364
3 years agoHelper II
Column DAX query
I am having data as per the below table Product Date Category Alpha 25-02-2023 Service Alpha 17-02-2023 Service Alpha 06-02-2023 Purchase Beta 05-02-2023 Purchase Beta 2...
Jihwan_Kim
3 years agoSuper User
Hi,
Please check the below picture and the attached pbix file.
New Category CC =
SWITCH (
TRUE (),
Data[Category] = "Purchase", Data[Category],
Data[Category] = "Service",
Data[Category] & "_"
& COUNTROWS (
WINDOW (
1,
ABS,
0,
REL,
SUMMARIZE (
FILTER ( Data, Data[Category] = "Service" ),
Data[Product],
Data[Date]
),
ORDERBY ( Data[Date], ASC ),
KEEP,
PARTITIONBY ( Data[Product] )
)
)
)
prashantg364
3 years agoHelper II
Thanks
but i am getting this output with your query
| Product | Date | Category | New Category |
| Alpha | 25-02-2023 | Service | Service_1 |
| Alpha | 17-02-2023 | Service | Service_1 |
| Alpha | 06-02-2023 | Purchase | Purchase |
| Beta | 05-02-2023 | Purchase | Purchase |
| Beta | 25-02-2023 | Service | Service_1 |
| Gama | 22-02-2023 | Service | Service_1 |
| Gama | 16-02-2023 | Service | Service_1 |
| Gama | 21-01-2023 | Purchase | Purchase |
| Gama | 17-02-2023 | Service | Service_1 |
- prashantg3643 years agoHelper II
Output is not unique...
Product Date Category New Category Delta 17-02-23 Puchase Purchase Delta 05-02-23 Service Service_1 Delta 06-02-23 Service Service_1 Delta 16-02-23 Service Sercvice_3