Forum Discussion

George1973's avatar
George1973
Helper V
2 years ago

Power BI How to Create Dynamic Conditional Column in matrix visual

Hi All,

I have a matrix visual having some columns and measures-in-a-row:

In a master data table, there are several columns, displaing Group_Discounts based on the year.. Meaning that 2024,2025,...2030 years have differennt discount rates for each company.

 



I have created a measure that shows the "% Rate" for each quater based on the year chosen in slicer (Green Arrow Direction).. 

 

Qtr Sales Bonus Var = 
VAR ChooseYear=SELECTEDVALUE(DateKey[Year])
VAR Leader=SELECTEDVALUE(C_CLIENTS[Client_Group])
RETURN
SWITCH(TRUE(),
    ChooseYear=2024,LOOKUPVALUE(Companies_Sales_Plan[2024_Motiv_Qtr],Companies_Sales_Plan[ლიდერის კოდი],Leader),
    ChooseYear=2025,LOOKUPVALUE(Companies_Sales_Plan[2025_Motiv_Qtr],Companies_Sales_Plan[ლიდერის კოდი],Leader),
    ChooseYear=2026,LOOKUPVALUE(Companies_Sales_Plan[2026_Motiv_Qtr],Companies_Sales_Plan[ლიდერის კოდი],Leader),
    ChooseYear=2027,LOOKUPVALUE(Companies_Sales_Plan[2027_Motiv_Qtr],Companies_Sales_Plan[ლიდერის კოდი],Leader),
    ChooseYear=2028,LOOKUPVALUE(Companies_Sales_Plan[2028_Motiv_Qtr],Companies_Sales_Plan[ლიდერის კოდი],Leader),
    ChooseYear=2029,LOOKUPVALUE(Companies_Sales_Plan[2029_Motiv_Qtr],Companies_Sales_Plan[ლიდერის კოდი],Leader),
    ChooseYear=2030,LOOKUPVALUE(Companies_Sales_Plan[2030_Motiv_Qtr],Companies_Sales_Plan[ლიდერის კოდი],Leader),
    BLANK())

 


However, I want to have it kept as a "Dynamic Column" instead of the "Red" marked static column from the master table.

Please advise your solution. So far, I have never tried to create a "Dynamic" column in Matrix visual, thinkin that column is a matrix should be always a static column from the master table.

3 Replies

  • Unpivot your data in Power Query to bring it into a usable format.

    • George1973's avatar
      George1973
      Helper V

      Hi,

       

      Thanks for your suggestion. I  will try, but from this first perspective, I'm not sure that it is a right solution.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you lbendlin for your prompt reply.

    Hi George1973 ,
    May I ask if you have tried the suggestions above? If the suggestion helped you, you might consider marking it as a solution. If the problem has not yet been solved, could you provide more data (excluding private information) so that we can better understand and solve the problem you are experiencing.

    How to Get Your Question Answered Quickly - Microsoft Fabric Community

    If it does not help, please provide more details with your desired out put and pbix file without privacy information.

     

    Best Regards,

    Ada Wang

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