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 have a table (see Fig. 1) with three columns: company name, year, and sales. Years range from 2019 to 2021. I want to filter only companies that have data for 2021 and show their historic sales (see Fig. 2). I tried using "Table" and "Matrix" with a filter that uses year but it removes all data for previous years. What should I do?
Fig. 1:
Fig. 2:
Solved! Go to Solution.
Hi @gorsheep
please try
Measure1 =
VAR MaxYearWithSales =
CALCULATE ( MAX ( TableName[Year] ), REMOVEFILTERS () )
VAR CompaniesSoldMaxYear =
CALCULATETABLE (
VALUES ( TableName[Company] ),
TableName[Year] = MaxYearWithSales,
REMOVEFILTERS ()
)
RETURN
CALCULATE (
SUM ( TableName[Sales] ),
INTERSECT ( VALUES ( TableName[Company] ), CompaniesSoldMaxYear )
)
Hi @gorsheep
please try
Measure1 =
VAR MaxYearWithSales =
CALCULATE ( MAX ( TableName[Year] ), REMOVEFILTERS () )
VAR CompaniesSoldMaxYear =
CALCULATETABLE (
VALUES ( TableName[Company] ),
TableName[Year] = MaxYearWithSales,
REMOVEFILTERS ()
)
RETURN
CALCULATE (
SUM ( TableName[Sales] ),
INTERSECT ( VALUES ( TableName[Company] ), CompaniesSoldMaxYear )
)
You are truly a magician, thank you so much! Totally worked!
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 |
---|---|
114 | |
99 | |
82 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |