The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Dear Team,
I have one DAX formula which is bit slow and it's not written in proper way, and I would like to rewrite this DAX code in some efficient way. Can someone assist me to rewrite this code please?
DAX
Select =
SWITCH (
MIN ( 'z III version selection'[slectionnum] ),
1,
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = 1,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
),
2,
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = 2,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
),
3,
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = 3,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
),
4,
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = 4,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
),
5,
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = 5,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
),
6,
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = 6,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
),
7,
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = 7,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
),
8,
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = 8,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
),
9,
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = 9,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
),
10,
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = 10,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
),
11,
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = 11,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
)
)
Solved! Go to Solution.
Select =
var __min = MIN ( 'z III version selection'[slectionnum] ) return
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = __min,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
)
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
Try this please:
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Select =
var __min = MIN ( 'z III version selection'[slectionnum] ) return
CALCULATE (
[TotalAmount],
Azdan_data[Scenario] = "Budget",
'Azdan_data'[Version lookup] = __min,
LEFT ( Azdan_data[Account Code], 3 ) <> "414"
)
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
Try this please:
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
User | Count |
---|---|
15 | |
13 | |
8 | |
6 | |
6 |
User | Count |
---|---|
24 | |
19 | |
12 | |
9 | |
7 |