Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
95 | |
80 | |
67 | |
62 |
User | Count |
---|---|
138 | |
107 | |
104 | |
82 | |
63 |