Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Using Power FX to add a new column of numbers, which are based on categories in a choice column - I.e., Codifying the value of text categories.

(0) ShareShare
ReportReport
Posted on by 4

Hi,

 

As calculated columns are being discontinued in favour of formulas - I need help recreating this simple task via a formula (See attached image of how I used a calculated column.)

 

In my model driven app, I have a simple global, choice column called "Significance", with 5 choices - International, National, State, Regional, Local. 

 

I need a column that codifies/quantifies these categories, according their scope, into whole numbers - so International = 5, National = 4 etc.. So that I can graph them in a Chart in my App.  (I can't find any way of accessing the values I assigned to these choices when I created them)

 

In creating a new column using "Formula", I've tried many different formulas, but each gives error messages (here's 3 examples):

 If(Significance=Blank(),"",Significance ="International",5,Significance="National",4,Significance ="State",3,Significance="Regional",2,Significance="Local",1)

 

Switch(Significance,"International","5","National","4","State","3","Regional","2","Local","1","")

 

Switch(ThisItem.Significance,'Significance(Aim)'.'International',5,'Significance(Aim)'.'National',4,'Significance(Aim)'.'State',3,'Significance(Aim)'.'Regional',2,'Significance(Aim)'.'Local',1)

Please help!

Dtrain2024_1-1716848616062.jpeg

 

 

 

 

NB: "This.Item" doesn't seem to be an available formula in Model driven Power Fx...

NBB. I was able to do this easily with calculated columns, but when I attempt this I message "The Calculated behaviour will eventually be discontinued. We recommend using the Formula data type for calculations instead" so need the capacity to do this via a Formula. 

 

Dtrain2024_0-1716848535454.jpeg

 

 

 

 

Categories:
  • Dtrain2024 Profile Picture
    4 on at
    Re: Using Power FX to add a new column of numbers, which are based on categories in a choice column - I.e., Codifying the value of text categories.

    Unfortunately, this also results in the same error message..

     

    Maybe you can't create a formula data type that relies on a choice column??? (But I also had the same issues when trying to create a formula using a lookup column)..

     

    Noting, I don't experience any issues when coding choice column using the calculated fields....

     

    I need Microsoft to fix this issue BEFORE they discontinue calculated fields.. 

    Dtrain2024_0-1716446285305.png

     

  • mmbr1606 Profile Picture
    12,108 Super User 2025 Season 1 on at
    Re: Using Power FX to add a new column of numbers, which are based on categories in a choice column - I.e., Codifying the value of text categories.

    hey @Dtrain2024 

     

    can u try the switch function:

    Switch(
     Significance,
     "International", 5,
     "National", 4,
     "State", 3,
     "Regional", 2,
     "Local", 1,
     Blank()
    )
    

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard