Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Ritesh_Air
Post Patron
Post Patron

Create a calculate column consist of Prospective Customers for a product

Hi,

 

I am looking for prospects who didn't buy certain products. Like here: I have these customers who bought certain products (A, B, C etc...).

 

 

Ritesh_Air_0-1602616187852.png

 

I am looking for something like this:

Customer 1 is only prospect for Product E,

Customer 2 is prospect for everything except A and C....so on and so forth.

 

I had a solution with measures but client is looking for calculated column so everything in one table. How do I achieve this? I have uploaded the pbix.

 

Ritesh_Air_1-1602616274925.png

 

https://drive.google.com/file/d/16UfeCTNx-8Ak-J2zPGeG80g3QsboBNbM/view?usp=sharing

 

Thanks,

-rk

 

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

Here's a solution that uses Power Query instead.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXIEYkMDA6VYHQjfCYiNkPjOaHwXJL4Rmn4jqHpjKN8YTd4Yaj4y3xXGjwUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Customer = _t, Product = _t, CY = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"CY", Int64.Type}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Product]), "Product", "CY"),
    #"Replaced Value" = Table.ReplaceValue(#"Pivoted Column",null,0,Replacer.ReplaceValue,{"A","B","C","D","E"}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Replaced Value", {"Customer"}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each ([Value] = 0))
in
    #"Filtered Rows"

View solution in original post

v-lionel-msft
Community Support
Community Support

Hi @Ritesh_Air ,

 

Based on @lbendlin ‘s solution, you can  create a calculated column.

v-lionel-msft_0-1603074474623.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

2 REPLIES 2
v-lionel-msft
Community Support
Community Support

Hi @Ritesh_Air ,

 

Based on @lbendlin ‘s solution, you can  create a calculated column.

v-lionel-msft_0-1603074474623.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

lbendlin
Super User
Super User

Here's a solution that uses Power Query instead.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXIEYkMDA6VYHQjfCYiNkPjOaHwXJL4Rmn4jqHpjKN8YTd4Yaj4y3xXGjwUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Customer = _t, Product = _t, CY = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"CY", Int64.Type}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Product]), "Product", "CY"),
    #"Replaced Value" = Table.ReplaceValue(#"Pivoted Column",null,0,Replacer.ReplaceValue,{"A","B","C","D","E"}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Replaced Value", {"Customer"}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each ([Value] = 0))
in
    #"Filtered Rows"

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.