Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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
User | Count |
---|---|
126 | |
108 | |
99 | |
65 | |
62 |
User | Count |
---|---|
136 | |
113 | |
102 | |
71 | |
60 |