The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Sharing : link for PBIX and EXCEL files
https://drive.google.com/file/d/14SBMji1NqkCwShszz8Ap6Fi5g3ACpbAi/view?usp=sharing - PBIX
https://drive.google.com/file/d/1-ZjTkywhMso1UpEnlkzkWbrvaX2eWpj_/view?usp=sharing - EXCEL
Solved! Go to Solution.
Hi @TiwariNeha ,
Based on your description, Please create a sort measure first.
RANK =
RANKX (
FILTER ( ALLSELECTED ( Master ), Master[product id] = SELECTEDVALUE ( Master[product id] ) ),
CALCULATE ( SELECTEDVALUE (Master[Snap_date]) ),
,
DESC,
DENSE
)
Measure = CALCULATE(SUM(Master[(Sales_order_history)]),FILTER(ALLSELECTED(Master),[RANK]=1))
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Nathaniel_C Nathaniel,
Thanks for your reply. The output that is coming from the suggested calculation is different from the expected solution.
Let me explain , if we dont take the sanpdate 06/22/2020, then for period date 06/01/2020, Sum should be 1300 for product id 9 and 10 as there are no duplicates for that particular dates.
Thanks & Regards:
Neha
Hi @TiwariNeha ,
Based on your description, Please create a sort measure first.
RANK =
RANKX (
FILTER ( ALLSELECTED ( Master ), Master[product id] = SELECTEDVALUE ( Master[product id] ) ),
CALCULATE ( SELECTEDVALUE (Master[Snap_date]) ),
,
DESC,
DENSE
)
Measure = CALCULATE(SUM(Master[(Sales_order_history)]),FILTER(ALLSELECTED(Master),[RANK]=1))
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @TiwariNeha , Not sure if I understand what you want, however try this:
Sum of Sales =
VAR _curSnapDate =
MAX ( Master[Snap_date] )
VAR _curProductID =
MAX ( Master[product id] )
VAR _curCustomerID =
MAX ( Master[customer id] )
VAR _calc =
CALCULATE (
MAX ( Master[(Sales_order_history)] ),
FILTER (
ALL ( Master ),
Master[customer id] = _curCustomerID
&& Master[product id] = _curProductID
&& Master[Snap_date] = MAX ( Master[Snap_date] )
)
)
VAR _maxDate =
CALCULATE (
MAX ( Master[Snap_date] ),
FILTER (
ALL ( Master ),
Master[customer id] = _curCustomerID
&& Master[product id] = _curProductID
)
)
RETURN
IF ( _maxDate = _curSnapDate, _calc )
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel
Proud to be a Super User!