web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using Power FX to add ...
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:
I have the same question (0)
  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    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

  • Dtrain2024 Profile Picture
    4 on at

    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

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard