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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
didakk
Regular Visitor

Get the Category in a Calculated column based on conditions/filters on other columns

Hi everyone,

 

I'm struggling figuring out how to solve this:

 

I have the following table

 

Channel - MMM OptimizerTipoGroup - MMM OptimizerPAISYearReal_GroupRankDesired Column
OTV%_VolMediaGT2019Media1OTV
OTV%_VolMediaGT2020Media1OTV
OTV%_VolMediaGT2021Media1OTV
OTV%_VolMediaGT2022Media1OTV
Social Media%_VolMediaGT2019Media2Social Media
Social Media%_VolMediaGT2020Media2Social Media
Display%_VolMediaGT2021Media2Social Media
Social Media%_VolMediaGT2022Media2Social Media
PTV%_VolMediaGT2019Media3Display
Display%_VolMediaGT2020Media3Display
Social Media%_VolMediaGT2021Media3Display
Display%_VolMediaGT2022Media3Display
Search%_VolMediaGT2019Media4Search
PTV%_VolMediaGT2020Media4Search
Search%_VolMediaGT2021Media4Search
Search%_VolMediaGT2022Media4Search
Youtube%_VolMediaGT2019Media5PTV
Search%_VolMediaGT2020Media5PTV
PTV%_VolMediaGT2021Media5PTV
PTV%_VolMediaGT2022Media5PTV
Display%_VolMediaGT2019Media6Youtube
Youtube%_VolMediaGT2020Media6Youtube
Youtube%_VolMediaGT2021Media6Youtube
Youtube%_VolMediaGT2022Media6Youtube
ABOX%_VolMediaGT2019Media7ABOX
ABOX%_VolMediaGT2020Media7ABOX
ABOX%_VolMediaGT2021Media7ABOX
ABOX%_VolMediaGT2022Media7ABOX

 

The "Desired Column" must be calculated based on the following criteria:

 

The user selects a Year in a slicer,  in this case "2022". The desired column must have on each row the Channel which had that RANK, in that Year (2022), in that Real_Group (Media), in that Country (GT).

 

I.E: 

in 2019, 2020, 2022 Social Media Channel ranked 2nd. In 2021 display was 2nd. If the user selects 2022, the Desired Column must show Social Media. If selects 2021 must show Display

 

Desired Column output when Selected Year =  2022

Channel - MMM OptimizerTipoGroup - MMM OptimizerPAISYearReal_GroupRankDesired Column
Social Media%_VolMediaGT2019Media2Social Media
Social Media%_VolMediaGT2020Media2Social Media
Display%_VolMediaGT2021Media2Social Media
Social Media%_VolMediaGT2022Media2Social Media

 

Desired Column output when Selected Year =  2021

Channel - MMM OptimizerTipoGroup - MMM OptimizerPAISYearReal_GroupRankDesired Column
Social Media%_VolMediaGT2019Media2Display
Social Media%_VolMediaGT2020Media2Display
Display%_VolMediaGT2021Media2Display
Social Media%_VolMediaGT2022Media2Display

 

There are more countries and more Real_Groups. This should be done by Real_Group, By country taking into account the Year selected and the rank 😞

 

I don't know how to proceed. May you please help me out whith this?

1 ACCEPTED SOLUTION

@didakk here is the pbix file for you. 

https://file.io/KY09NDhDk5iF 

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


View solution in original post

4 REPLIES 4
rubayatyasmin
Super User
Super User

Hi, @didakk 

 

first of all calculated columns don't handle users selection like slicer selection. You need to use measure for that. 

Now, I tried to reproduce your problem, You need to add rank as your slicer. and you do want the columns to interact within the visual dynamically. I think you need to create another calculated table that will work on your row selection. 

 

rubayatyasmin_0-1691129867244.pngrubayatyasmin_1-1691129898033.png

 

if this is the solution you want then I can provide you the pbix or the measures. Let me know if that helps. 

 

rubayatyasmin_0-1689517080227.png

 


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Hi @rubayatyasmin,

 

Thanks for your response.  I think this might help a lot. May you please share the PBI or the measure to do testing?

 

Thank you very much

@didakk here is the pbix file for you. 

https://file.io/KY09NDhDk5iF 

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Thanks @rubayatyasmin 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors