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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
tomislav_mi
Helper II
Helper II

Calculated column - creating partition based on multiple values

Hello all,

I am struggling with how to create one complex calculated column. Desired calculated column is in orange Active Channel Customer.

The idea is to use the column Active Channel Account to create a new column Active Channel Customer
- If the account is active in a specific month, then the Active Channel Account will be a channel for customer level - column Active Channel Customer
- If there are 2 types of channels then the value in the calculated column is going to be "both"

Report DateAccountCustomerActiveActive Channel AccountActive Channel Customer
6/30/2022a1AFALSE Reseller
6/30/2022a2ATRUEResellerReseller
6/30/2022a3AFALSE Reseller
6/30/2022a4ATRUEResellerReseller
7/31/2022a1AFALSE Direct
7/31/2022a2AFALSE Direct
7/31/2022a3ATRUEDirectDirect
7/31/2022a4AFALSE Direct
6/30/2022b1bTRUEDirectBoth
6/30/2022b2bTRUEResellerBoth


Any help or advice is welcome.

Thanks!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@tomislav_mi , Try a new column like

 

new column =
var _1 = countx(filter(Table, [Customer] = earlier([Customer]) && [Report Date] = earlier([Report Date]) && [Active Channel] = "Reseller"), [Customer])
var _2 = countx(filter(Table, [Customer] = earlier([Customer]) && [Report Date] = earlier([Report Date]) && [Active Channel] = "Direct"), [Customer])
return
Switch(true(),
not(isblank(_1)) && not(isblank(_2)) , "Both",
not(isblank(_1)),"Reseller",
"Direct"
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@tomislav_mi , Try a new column like

 

new column =
var _1 = countx(filter(Table, [Customer] = earlier([Customer]) && [Report Date] = earlier([Report Date]) && [Active Channel] = "Reseller"), [Customer])
var _2 = countx(filter(Table, [Customer] = earlier([Customer]) && [Report Date] = earlier([Report Date]) && [Active Channel] = "Direct"), [Customer])
return
Switch(true(),
not(isblank(_1)) && not(isblank(_2)) , "Both",
not(isblank(_1)),"Reseller",
"Direct"
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

Exactly what I was struggling to get! Great approach.
Thank you!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.