Forum Discussion
calculate measure help..
- 5 years ago
- Anonymous5 years ago
Hi srk_powerbi ,
Based on your sample data, you can create the following measure. My measure is updated dynamically, no slicer selection is required.
% cexpected = var _aa=CALCULATE(SUM('Table'[Amount]),FILTER('Table',[CalcType]="sales"&&[Fy]<=YEAR(TODAY())&&[Fm]<=MONTH(TODAY()))) var _bb=CALCULATE(SUM('Table'[Amount]),FILTER('Table',[CalcType]="sales expected"&&[Fy]<=YEAR(TODAY())&&[Fm]<=MONTH(TODAY()))) return DIVIDE(_aa-_bb,_aa)Tips: [Fm] column is a calculated column which retruns the month number.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
srk_powerbi although Ashish_Mathur solution will work in that case you have to select a period. if your ask is to always calculate % until previous month without selecting a month, add this measure (it is based on the file that Ashish_Mathur shared in his response)
% Expected until Last Month =
VAR __date = EOMONTH ( TODAY(), -1 )
RETURN
CALCULATE ( DIVIDE ( [Numerator], [Sales YTD] ), 'Calendar'[Date] <= __date )
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡