Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hey All,
Hope anyone can help, what I'm trying to accomplish is a bit of logic to add columns to a table based off another table. In a measure, I think I can accomplish this more easily but this data (which can be larger) will be digested in Excel. Anyways, the logic needs to be a such:
One table is a financial table, this table has an account # (cost element) and this along with a variant will decide the regulatory account which is based off another table.
So the 1st table is the financial table:
Order number | Reg Ind | Cost element | Jan | Variant | Reg Acct |
1001 | 4620 | 600200140 | 29,152.00 | OPSE | F4320 |
1052 | 4600 | 886899999 | (2,624.00) | F4040 | F4040 |
1057 | 4800 | 622100800 | (3,954.00) | OEED | F5890 |
1058 | 5500 | 622100801 | 8,492.00 | OEED | F5890 |
1062 | 4560 | 649900200 | 271.00 | OEED | F4560 |
1063 | 4560 | 649900200 | 1,574.00 | OEED | F4560 |
The Reg Acct column is the one I need, it's based off another table's dimensions. (Reg Table)
Variant | From Cost Element | To Cost Element | Regulatory account |
OPSE | 621000135 | 621000150 | F4320 |
ALL | 600300240 | 600300240 | F5550 |
ALL | 886809999 | 886809999 | F4040 |
OEED | 622100800 | 622100849 | F5890 |
So the gist is, go to the financial table and 1 of 3 things occurs: (bold in Financial Table is desired result)
#1 Looking up cost element from financial table, compare to Reg Table and check to see if it falls between "from" or "to" cost elements, if Variant from Reg Table says "All", then simply return Regulatory Account from Reg Table
#2 Look up cost element from financial table, find range from Reg Table and if also a match of Variant between the two tables, return the combination of the two from the Regulatory Account from the Reg Table.
#3 If cost element from financial table does not fall into the range of cost elements from Reg table OR does fall into the range but no match of BOTH cost element range AND Variant then return Reg Account from Financial Table (+ "F" preceding
Ross, I gave it a shot and the formulas seem to make sense but I'm not getting the desired results, basically getting nothing. I tried to attach the sample file and unsure if I did a good job of communicating what I required.
Thanks!
Sorry Danminar, i'm not in a position to be downloading and reviewing other people files.
No worries, totally understand you at least gave me a direction...
I think i understand what you are asking for but if not hopefully the below will give you a starting point to work from. It is assumed the below is a DAX calculated column called "Reg Acct" for your Financial Table
Reg Acct = VAR finCostElement = [Cost element]
VAR finVariant = [Variant]
VAR regVariant = CALCULATE(
SELECTEDVALUE('RegTable'[Varient]),
FILTER(
ALL('RegTable'),
'RegTable'[From Cost Element] <= finCostElement &&
'RegTable'[ToCost Element] >= finCostElement
)
var regRegAccount = CALCULATE(
SELECTEDVALUE('RegTable'[Regulatory account]),
FILTER(
ALL('RegTable'),
'RegTable'[From Cost Element] <= finCostElement &&
'RegTable'[ToCost Element] >= finCostElement
)
)
VAR output = IF(
regVariant = "ALL",
regRegAccount, //#1 result
IF(
finVariant = regVariant,
regRegAccount, #2 result
regRegAccount & "F" // #3 result
)
)
RETURN
output
User | Count |
---|---|
123 | |
76 | |
63 | |
50 | |
50 |
User | Count |
---|---|
175 | |
125 | |
60 | |
60 | |
58 |