The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I want to create a new table that contain a distinct value of SKU. However, when I try with filters, the distinct values can not comply with the DAX code so I don't know where should I put the distinct code. Here is my code, basically I need the distinct values of SKU along with the brands and their descriptions. I also want to apply the filters where the SKU code must not start with "S", "O" and list of SKU with condition (brand<>blank()&&left(sku,1)="C-")
FILTER(SUMMARIZECOLUMNS(ItemPackage[SKU],ItemPackage[PackageDescription],ItemPackage[Brand Name]),LEFT(ItemPackage[SKU],1)<>"S"&&LEFT(ItemPackage[SKU],1)<>"O"&&(ItemPackage[Brand Name]<>BLANK()&&LEFT(ItemPackage[SKU],1)="C")))
I sent you a private message. Or do you have any suggestion for me to give you the sample data? Seems like I can't paste the data here
@Anonymous , Try like
SUMMARIZE(FILTER(ItemPackage, not(LEFT(ItemPackage[SKU],1) in {"S","O","C"}) && not(isblank(ItemPackage[SKU]))), ItemPackage[SKU],ItemPackage[PackageDescription],ItemPackage[Brand Name])
or
SUMMARIZE(FILTER(ItemPackage, not(LEFT(ItemPackage[SKU],1) in {"S","O","C"}) && not(isblank(ItemPackage[SKU]))), ItemPackage[SKU],ItemPackage[PackageDescription]."Brand Name",max(ItemPackage[Brand Name]))
Thank you for taking your time to answer my question but this will make the SKU appear twice/more than once (not distinct) if the descriptions are not same. I need the SKU to be distinct regardless of the description.
@Anonymous , try like
SUMMARIZE(FILTER(ItemPackage, not(LEFT(ItemPackage[SKU],1) in {"S","O","C"}) && not(isblank(ItemPackage[SKU]))), ItemPackage[SKU],"PackageDescription" ,max(ItemPackage[PackageDescription]),"Brand Name",max(ItemPackage[Brand Name]))
What if I need to add more condition that check 2 fields? The SKU that starts with C and brand that is blank, need to be removed. The additional condition is the same as this LEFT(ItemPackage[SKU],1)=2 && ItemPackage[Brand Name]<>BLANK() . I tried this code but turns out it delete all of the rows that starts with other codes.
SUMMARIZE(FILTER(ItemPackage, not(LEFT(ItemPackage[SKU],1) in {"S","O","P","M"}) && (LEFT(ItemPackage[SKU],1) in {"C"} && ItemPackage[Brand Name]<>BLANK())&& NOT(CONTAINSSTRING(ItemPackage[PackageDescription],"Do not use")) && NOT(CONTAINSSTRING(ItemPackage[PackageDescription],"OBSOLETE"))), ItemPackage[SKU],"PackageDescription" ,max(ItemPackage[PackageDescription]),"Brand Name",max(ItemPackage[Brand Name]))
@Anonymous , Seem fine. Try with one change
SUMMARIZE(FILTER(ItemPackage, not(LEFT(ItemPackage[SKU],1) in {"S","O","P","M"}) && (LEFT(ItemPackage[SKU],1) in {"C"} && not(isblank(ItemPackage[Brand Name])))&& NOT(CONTAINSSTRING(ItemPackage[PackageDescription],"Do not use")) && NOT(CONTAINSSTRING(ItemPackage[PackageDescription],"OBSOLETE"))), ItemPackage[SKU],"PackageDescription" ,max(ItemPackage[PackageDescription]),"Brand Name",max(ItemPackage[Brand Name]))
Remove filter one by one check which one is causing this
Still. I'm supposed to have more than 9000 rows and now only left with 1000 rows. Other codes are removed like SKU that starts with B
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |