Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hello there,
The DAX measure below is not working:
Solved! Go to Solution.
Hello @MFelix ,
Here is how I've fixed it:
Primeira Compra = CALCULATE(FIRSTDATE('Calendário'[Date]); ALL('Calendário'[Date]); FILTER( ALL(SalesTable); SalesTable[ClienteId] = MAX(SalesTable[ClienteId]) ))
Thanks a lot for your help!
Hi @Asantos2020 ,
Measure are based on context and using the ALL function on your measure returns all the rows in a table, or all the values in a column, ignoring any filters that might have been applied. This function is useful for clearing filters and creating calculations on all the rows in a table.
Looking at your calculation and I'm assuming that your calendário table is connected to the sales what is happening is that you are picking up the minimum date of your calendar since you are ignoring all the filters (changing the context).
Try the following code instead:
FirstPurchase = CALCULATE ( FIRSTDATE ( SalesFactTable[Date] ); ALL ( 'Calendário'[Date] ); FILTER ( ALL ( SalesFactTable[Customer]; SalesFactTable[Purchase Cycle] ); SalesFactTable[Customer] = MAX ( SalesFactTable[Customer] ) && SalesFactTable[Purchase Cycle] = MAX ( SalesFactTable[Purchase Cycle] ) ) )
If this doesn't work can you share a sample of your data and expected result?
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHello @MFelix ,
Here is how I've fixed it:
Primeira Compra = CALCULATE(FIRSTDATE('Calendário'[Date]); ALL('Calendário'[Date]); FILTER( ALL(SalesTable); SalesTable[ClienteId] = MAX(SalesTable[ClienteId]) ))
Thanks a lot for your help!
Hi @Asantos2020 ,
On your example wasn't clear that one of the columns was a measure, but a measure is based on context and this can be given by other measures on your case that is what happened.
Regards,
Mfelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHello, @MFelix .
Sorry I forgot to mention that the Purchase Cycle is a measure that has FirstPurchase as a calculation factor. Therefore, I'd assume that I should use another implicit column in the DAX formula, like CustomerID...?
I did so, but the column presented the correct first purchase for a couple of customers in the list only. The majority resulted in 31/12/1899.
At the end, we need to have both FIRST PURCHASE and LASTPURCHASE ignore date filter, so that I can have a Purchase Cycle for customer x, y and z to let Sales Team know as to those customers' purchasing profile.
Appreciate your attention on this one!
Regards,
Antonio Santos
User | Count |
---|---|
64 | |
59 | |
47 | |
33 | |
32 |
User | Count |
---|---|
84 | |
75 | |
56 | |
50 | |
44 |