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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
netanel
Post Prodigy
Post Prodigy

left or Other Solution

Hi All,

I have a table that contains accounts by levels
In the measure I created, I create another column that will define that if the beginning of one of the accounts begins with the following numbers(5,6,7,8,9), then the column will write -1 otherwise 1

My problem is that I can only do this for one column.
Is it possible to do this for all the columns in the table?
Is there a smarter solution?

Agg +-  = IF(LEFT(EpmAccount[AccountLvl9],1) = "5"&&"6"&&"7"&&"8"&&"9",-1,1)

2022-08-09_16-40-31.png

Thanks!








Did I answer your question?
Mark my post as a solution!
Appreciate your Kudos!

Connect on Linkedin
linkedin.com/in/netanel-shriki
1 ACCEPTED SOLUTION

Hi,

I am not 100% I understood your goals. Anyway when it comes to defining balance sheet and profit and loss accounts functions such as PATH + PATHITEM are quite useful (you could use these to define all sorts of hierarchial logics with key pairs. Additionally I would look into enriching the data at account level either in PQ or with DAX .e.g you could create a custom column in PQ which would contain start and end account based on the range values you have and then expand this to multiple rows thus creating +/- information on account level. The main benefit of doing this on account level is that you could ignore some of the challenges posed by hierachy. Alternatively you could create the hierarchy logic entirely within the SWITCH. 

I hope these suggestions/ideas help you with the issue at hand!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ValtteriN
Super User
Super User

Hi,

If the amount of account columns is manageable I would use SWITCH + TRUE and LEFT+ in like this:

ValtteriN_0-1660060740982.png


Otherwise I would add a new table to the model where you have defined the logic in PQ or e.g. in excel and then use this as a basis for mapping.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @ValtteriN ,


Your measure is excellent and helped me in this case half a solution

But I used IF to try to change the plus or minus from one hierarchy to another
The hierarchy are in the same table in column AccountLvl2

2022-08-10_16-11-22.png
IF AccountLvl2  is PBI then the formula we wrote
And so on

Thanks!

 








Did I answer your question?
Mark my post as a solution!
Appreciate your Kudos!

Connect on Linkedin
linkedin.com/in/netanel-shriki

Hi,

I am not 100% I understood your goals. Anyway when it comes to defining balance sheet and profit and loss accounts functions such as PATH + PATHITEM are quite useful (you could use these to define all sorts of hierarchial logics with key pairs. Additionally I would look into enriching the data at account level either in PQ or with DAX .e.g you could create a custom column in PQ which would contain start and end account based on the range values you have and then expand this to multiple rows thus creating +/- information on account level. The main benefit of doing this on account level is that you could ignore some of the challenges posed by hierachy. Alternatively you could create the hierarchy logic entirely within the SWITCH. 

I hope these suggestions/ideas help you with the issue at hand!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors