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.
Hi all,
I seem to be having trouble creating a variable value for a sort of do while loop.
My formula works fine. But I need '[Object sort]-<number>' to work as a variable. How does this work?
Is this possible in DAX?
RESULT =
IF(
[Object A]=""
SWITCH(
TRUE(),
LOOKUPVALUE(EQUIPMENTS[Object A],[Object sort],[Object sort]-1)<>"",LOOKUPVALUE(EQUIPMENTS[Object A],[Object sort],[Object sort]-1),
LOOKUPVALUE(EQUIPMENTS[Object A],[Object sort],[Object sort]-2)<>"",LOOKUPVALUE(EQUIPMENTS[Object A],[Object sort],[Object sort]-2),
LOOKUPVALUE(EQUIPMENTS[Object A],[Object sort],[Object sort]-3)<>"",LOOKUPVALUE(EQUIPMENTS[Object A],[Object sort],[Object sort]-3),
LOOKUPVALUE(EQUIPMENTS[Object A],[Object sort],[Object sort]-4)<>"",LOOKUPVALUE(EQUIPMENTS[Object A],[Object sort],[Object sort]-4),
LOOKUPVALUE(EQUIPMENTS[Object A],[Object sort],[Object sort]-5)<>"",LOOKUPVALUE(EQUIPMENTS[Object A],[Object sort],[Object sort]-5),
.........
),
BLANK()
)
@enieuwer Here is how to do For and While loops in DAX: For and While Loops in DAX – Greg Deckler
And the videos:
Hi Greg,
Thank you for you swift answer.
Unfortunately your solution is above my knowledge of DAX. I was hoping for an easier solution.
Hi @enieuwer ,
In order to get a better understanding on your requirement and give you a suitable solution, could you please provide some raw data in your table 'EQUIPMENTS' (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
145 | |
87 | |
66 | |
52 | |
45 |
User | Count |
---|---|
215 | |
90 | |
83 | |
66 | |
58 |