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've been having issues with a measure that doesn't return the value you'd expect. I did find a topic where the user had the same issue, but the answer didn't quite explain why they should use ALL(), and in my case I do need filters to apply when calculating the measure :
Monthly period | Quantity | Type |
202108 | 1 | Online |
202108 | 2 | Wholesale |
202109 | 5 | Wholesale |
202109 | 1 | Wholesale |
Latest Quantity:=
VAR Max_Date =
MAX ( 'Sales'[MONTHLY_PERIOD] )
RETURN
CALCULATE (
SUM ( 'Sales'[Quantity] ),
Sales[MONTHLY_PERIOD] = Max_Date
)
This returns the entire sum of 9 whereas what I want it to return is 6, the sum for the latest period only.
I also want it to take into account the filters that are apply, so it should return 1 if I apply a 'Type = Online' filter.
Is there any way to resolve this ?
Thanks in advance.
Hi @Anonymous
I put your measure in a card visual and use a slicer to filter Type column. The result is correct as expected. See the attached pbix. Which visual do you put this measure in? If you put other columns into the same visual, they may provide some filters to the measure result.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
@Anonymous , Try like
Latest Quantity:=
VAR Max_Date =
MAXX (allselected('Sales'), 'Sales'[MONTHLY_PERIOD] )
RETURN
CALCULATE (
SUM ( 'Sales'[Quantity] ),
filter(sales, Sales[MONTHLY_PERIOD] = Max_Date)
)
Hi @amitchandak ,
Thanks for your answer, althouh I tried this solution and it still returns the total sum of the sales.
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 |
---|---|
113 | |
99 | |
76 | |
73 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |