Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
I'm trying to find the number of customers who ordered "SAMEPERIODLASTYEAR" but not this year.
Here's my formula:
Non reco =
VAR CurrentFY = CALCULATE(
SUM(Overview[Net Invoice Sales])
)
VAR YAG = CALCULATE(
SUM(Overview[Net Invoice Sales]);
SAMEPERIODLASTYEAR('Date'[Date])
)
RETURN
CALCULATE(
--YAG-CurrentFY
DISTINCTCOUNT(Overview[Customer]);
FILTER(Overview;YAG>0);
FILTER(Overview;CurrentFY=0);
)
All I get is an empty column.
For info, when I simply try to do "YAG-CurrentFY", i do get a figure, proving if need be that I should get customers who didnt order this year.
For better understanding, my 'Overview' table is a big table (~6M rows) with a detail of all units ordered by customers with the corresponding order date. My 'Date' table is a... date table, and declared as such through PowerBI.
Solved! Go to Solution.
Hi @amitchandak ,
Thanks a lot for your quick reply.
I tried your technique, but it didnt work.
I have however found the solution, as my own summarize for previous year was incorrectly created due to a pre-existing slicer.
To ignore said slicer, I used this formula:
Non reco =
VAR YAG = SUMMARIZE(
CALCULATETABLE(
Overview,
ALL('Date'[Date]),
SAMEPERIODLASTYEAR('Date'[Date])
),
Overview[Customer]
)
VAR CurrentFiscal = SUMMARIZE(
Overview,
Overview[Customer]
)
RETURN
COUNTROWS(EXCEPT(YAG,CurrentFiscal))
@Anonymous , Try to change return as
CALCULATE(
DISTINCTCOUNT(Overview[Customer]);
FILTER(all(Overview);YAG>0 && coalesce(CurrentFY,0)= 0)
)
As the date range will apply to the return statement, those who did not have sales year will not come. So need to use all
Hi @amitchandak ,
Thanks a lot for your quick reply.
I tried your technique, but it didnt work.
I have however found the solution, as my own summarize for previous year was incorrectly created due to a pre-existing slicer.
To ignore said slicer, I used this formula:
Non reco =
VAR YAG = SUMMARIZE(
CALCULATETABLE(
Overview,
ALL('Date'[Date]),
SAMEPERIODLASTYEAR('Date'[Date])
),
Overview[Customer]
)
VAR CurrentFiscal = SUMMARIZE(
Overview,
Overview[Customer]
)
RETURN
COUNTROWS(EXCEPT(YAG,CurrentFiscal))
Hi @Anonymous ,
I'm glad you solved your problem and shared the solution. Please consider Accept it as the solution to help the other members find it more quickly.
Thanks for your understanding and support.
Best Regards,
Dedmon Dai
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |