The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi
I am struggling with a measure that need to show a sum of orders based on a filter
when i specify the filter value with a literal like this
Solved! Go to Solution.
Try this one...We need to take measure out of FILTER function
Orders 2018 with Measure = VAR myyear = [Year # 1] RETURN CALCULATE ( SUM ( orders[qty] ), FILTER ( orders, orders[year] = myyear ) )
Hi @mejiaks
As tested, Zubair_Muhammad's suggestion should be helpful.
If it doesn't solve your requirement as said below.
"compare two years selected by the user and calculate difference between the two measures "
you could take my advice as below.
create a new table
Table2 = VALUES(Sheet7[year])
don't create relationships among three tables.
create measures
Year_1 = IF ( HASONEVALUE ( Table1[year] ), VALUES( Table1[year]), 2018) Year_2 = IF ( HASONEVALUE ( Table2[year] ), VALUES( Table2[year]), 2018) Measure1 = VAR myyear = [Year_1] RETURN CALCULATE ( SUM (Sheet7[qty] ), FILTER ( ALL(Sheet7), Sheet7[year] = myyear ) ) Measure2 = VAR myyear = [Year_2] RETURN CALCULATE ( SUM (Sheet7[qty] ), FILTER ( ALL(Sheet7), Sheet7[year] = myyear ) )
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Try this one...We need to take measure out of FILTER function
Orders 2018 with Measure = VAR myyear = [Year # 1] RETURN CALCULATE ( SUM ( orders[qty] ), FILTER ( orders, orders[year] = myyear ) )
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
99 | |
93 | |
81 | |
63 | |
56 |
User | Count |
---|---|
248 | |
124 | |
111 | |
78 | |
78 |