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.
I thought this would be fairly simple but I'm not having any success with this metric.
I have a hierarchal date selection slicer that includes Fiscal Year, Fiscal Quarter, and Fiscal Month. I have one column with a margin % which responds to the date selection slicer. This is working as expected.
I need another column of this same margin % which will calculate the selected Fiscal Year in the slicer and ignore the Fiscal Quarter and Fiscal Month selections, so it always displays the full margin % for the year, regardless of what is selected in Fiscal Quarter and/or Fiscal Month.
I've tried, ALL, I've tried REMOVEFILTERS, and other approaches I've found in the forum and elsewhere but it does not calculate properly. It either continues to respond to the date selection or it filters all data for all years. I have even created a duplicate date table with no luck.
Can anyone advise?
Solved! Go to Solution.
Hi @lg1551 ,
Please try this measure.
fixed_Margin % =
var a =SELECTEDVALUE('date'[Date].[Year])
return
IF(YEAR(MAX('Table'[date]))=a,CALCULATE('Table'[your measure ],FILTER(ALL('Table'),YEAR('Table'[date])=a)),BLANK())
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @lg1551 ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) We can create two measures.
Margin % YTD =
var _a=CALCULATE(SUM('Table'[Margin]),FILTER(ALLSELECTED('Table'),YEAR('Table'[date])=YEAR(MAX('Table'[date]))))
var _b=CALCULATE(SUM('Table'[sales]),FILTER(ALLSELECTED('Table'),YEAR('Table'[date])=YEAR(MAX('Table'[date]))))
RETURN
_a/_b
_Margin % YTD =
var a =SELECTEDVALUE('date'[Date].[Year])
return
IF(YEAR(MAX('Table'[date]))=a,CALCULATE('Table'[Margin % YTD],FILTER(ALL('Table'),YEAR('Table'[date])=a)),BLANK())
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I probably should have clarified better in my remarks. The margin % I refer to is a measure, not a column from a data table. I am using it as a column in a matrix visualization.
Hi @lg1551 ,
Please try this measure.
fixed_Margin % =
var a =SELECTEDVALUE('date'[Date].[Year])
return
IF(YEAR(MAX('Table'[date]))=a,CALCULATE('Table'[your measure ],FILTER(ALL('Table'),YEAR('Table'[date])=a)),BLANK())
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Here are some tables to illustrate the functionality I want:
Full Year Selected | Full Year Selected | Q1 Selected | Q1 Selected | Q1 - Month 2 Selected | Q1 - Month 2 Selected | ||
Margin % YTD | Margin % | Margin % YTD | Margin % | Margin % YTD | Margin % | ||
98% | 98% | 98% | 130% | 98% | 146% |
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 |
---|---|
99 | |
99 | |
80 | |
77 | |
66 |
User | Count |
---|---|
134 | |
106 | |
105 | |
86 | |
72 |