cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

Issue with ALLSELECT

Hi

I am fairly new to DAX and am having a problem doing an advance calculation. Without going into the full-blown explanation of cohort Surval Rate calculation, I have tried to focus on a small using which I think stems from an ALLSELECT statement I use.

If someone can anyone please tell me what I am going wrong I would be extremely grateful!

The table below explains my issue. In summary, the measure GC2 works but I have a problem with the measure GC3. I see this is because the measure X3 returns ZEROs in each row and not 0.816 in each row. However, the calculation works in measure X2

The formulas are:

GC2=X2* Y2

GC3=X3* Y3

Where X2 and X3 are generated by the following formulas

X2 = CALCULATE([GC1],
FILTER(Allselected(SurvivalRate),

and

X3 = CALCULATE([GC2],
FILTER(Allselected(SurvivalRate),

You can open this link to my example file which I have published on my Onedrive account, but this table attempts to explain the issue.

2 ACCEPTED SOLUTIONS
Super User

@CrudenBoy  What is it you are ultimately trying to acheive? Do GC0, GC1, etc actually need to be in separate columns? I'm wondering if you could use the EARLIER function to create a series of calculated columns in a GradeCode table that has each grade code listed once?

https://blog.enterprisedna.co/how-to-use-the-earlier-function-in-power-bi-a-dax-tutorial/

Iterators might also help to lock in the row and table context that each measure needs to calculate within, rather than how they are now which is floating across the data model and recalculating depending on how you setup your table.

https://www.microsoftpressstore.com/articles/article.aspx?p=2449191&seqNum=3

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved.

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Frequent Visitor

Thank you very much for your feedback @Anonymous @AllisonKennedy  and @vivran22 and let me apologise for my limited description of my problem. Alison's post was very useful as it made me read up about the filter context and row context and I have managed to make progress.

4 REPLIES 4
Anonymous
Not applicable

Best
D
Frequent Visitor

Thank you very much for your feedback @Anonymous @AllisonKennedy  and @vivran22 and let me apologise for my limited description of my problem. Alison's post was very useful as it made me read up about the filter context and row context and I have managed to make progress.

Super User

@CrudenBoy  What is it you are ultimately trying to acheive? Do GC0, GC1, etc actually need to be in separate columns? I'm wondering if you could use the EARLIER function to create a series of calculated columns in a GradeCode table that has each grade code listed once?

https://blog.enterprisedna.co/how-to-use-the-earlier-function-in-power-bi-a-dax-tutorial/

Iterators might also help to lock in the row and table context that each measure needs to calculate within, rather than how they are now which is floating across the data model and recalculating depending on how you setup your table.

https://www.microsoftpressstore.com/articles/article.aspx?p=2449191&seqNum=3

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved.

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Community Champion

Hello @CrudenBoy ,

Can you explain the logic behind the calculation for X2, X3, Y2 & Y3 along with example?

Cheers!
Vivek

https://www.vivran.in/