Forum Discussion
Anonymous
6 years agoNot applicable
FOR loop equivalent in DAX?
Hi all, I'm looking to get feedback on how I could acheive something similiar to a loop in DAX. I'm familiar with SWITCH and already using it (as you can see in the code below) however I'm faced ...
Anonymous
6 years agoNot applicable
Hello all,
A sanitized version of my PBIX and data model are here (the link expires on 4/12, I'll try to renew it, if not post in this thread: https://stantec-my.sharepoint.com/:f:/p/robert_manna/EnbE-K84tNlHofWg91AVbvsBTw4VIFOkFbkvxbbaZK9Osg?e=4Z5rZR ), screen shot with mark-ups below.
- The data model is built as a fairly simple relational model, Excel was used for convience and portability
- The goal of this exericise is to allow an end user to distribute "Program" (area for specific uses) to different Sites using WhatIf parameters
- There is a certain amount of Program 'prog_ProposeProg'[Target Area]
- The Sites each have a certain amount of capcity 'site_Capacities'[Max GFA]
- The program is broken down into settings and then categories (the data actually breaks down to subcategories, but we're generally not concerned with that level of granularity). Some categories are dependent on others 'prog_Categories'[Dependent]
- So for each Site, Setting and (non-dependent) Category there will be sliders to allow user input/adjustment.
- Those sliders must then each be correlated with the proper row (Site, Setting, Category) so the remaining calculations and visualizations can be carried out, for example summing all area assigned to specific site, or illustrating the percentage distribution of program accross all the sites, etc. A key goal of this model is to ultimatly show "busts" if too much program is assigned to a specific site, therefore exceeding the SUMX('site_Capacities', [Max GFA]).
- Dependent Categories are assigned an "Average" based on related Dependent Categories, for example [1.acu.avg] found under 'Dependent % Area Measures'.
- There is a table set-up to correlate Site, Setting, Category, and Area: 'prog_SiteProgram' which is where the measures need to be applied in-line for each row of the table.
- Currently I have a Measure with the SWITCH function set-up with variables (see previous post or PBIX): [% of Prog]
- This measure is already 100+ lines, with only a small sub-sample of the WhatIf parameters built-out. With out figuring out a way to more econimcally iterate through and assign the WhatIf parameters (Measures) to the appropriate row, I estimate I'm looking at at least 500 lines in this single measure with plenty of opprotunity for error, even with the use of variables and copy/paste (oh how I wish Power BI had a true CDE).
- If you have suggestions on how I else I might approach this challenge, I'm open to suggestions. The goal is something highly portable and relatively modifieable that we can hand over to the client. The interactive feedback piece is crucial though I have been wondering if I should take a look at Power Apps in combination with Power BI, but that would make "portability" more complicated. Could or should this just be written as a WebApp with a simple DB back-end of some kind, maybe, probably, but again that impacts portability and easy of modification by the client/end user.
- Other suggestions or observations are welcome (I'm not Power BI / DAX expert).
Anonymous
6 years agoNot applicable
Giving this a tickle now that the Holiday weekend is wrapped up for most (see post above). I was hoping Greg_Deckler might have some additional feedback or thoughts.
Thanks for looking!