Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Please look at this dashboard just created to illustrate my problem:
First slicer represents the number of years (times) where data exists for an indicator series.
Second slicer represent the year to count from.
For Albania, as i show in the table, the series count should be 3. For Armenia should be 2.
The dashboard is using this data sample:
Country | Year | Indicator | Series |
Albania | 2015 | 1.1.1 | ind1 |
Albania | 2010 | 1.1.1 | ind1 |
Albania | 2016 | 1.1.1 | ind1 |
Albania | 2018 | 1.1.1 | ind2 |
Albania | 2011 | 1.1.1 | ind2 |
Albania | 2019 | 1.1.1 | ind2 |
Albania | 2015 | 1.1.1 | ind2 |
Albania | 2010 | 2.1.1 | ind3 |
Albania | 2016 | 2.1.1 | ind3 |
Albania | 2018 | 2.1.1 | ind4 |
Albania | 2011 | 2.1.1 | ind4 |
Albania | 2019 | 2.1.1 | ind4 |
Armenia | 2011 | 1.1.1 | ind1 |
Armenia | 2010 | 1.1.1 | ind1 |
Armenia | 2016 | 1.1.1 | ind1 |
Armenia | 2018 | 1.1.1 | ind2 |
Armenia | 2020 | 1.1.1 | ind2 |
Armenia | 2019 | 1.1.1 | ind2 |
Armenia | 2015 | 1.1.1 | ind2 |
Armenia | 2016 | 2.1.1 | ind3 |
Armenia | 2016 | 2.1.1 | ind3 |
Armenia | 2018 | 2.1.1 | ind4 |
Armenia | 2011 | 2.1.1 | ind4 |
Armenia | 2020 | 2.1.1 | ind4 |
Armenia | 2010 | 2.1.1 | ind4 |
This is my measure:
IndicatorSeriesCount =
VAR FilteredData =
FILTER(
Data,
Data[Year] >= [Year Value]
)
VAR IndicatorSeriesCounts =
SUMMARIZE(
FilteredData,
Data[Indicator],
Data[Series],
"YearCount", COUNTROWS(FilteredData)
)
VAR IndicatorSeriesWithMultipleYearsCount =
COUNTROWS(
FILTER(
IndicatorSeriesCounts,
[YearCount] > [Years Value]
)
)
RETURN IndicatorSeriesWithMultipleYearsCount
I think the problem is that i need to include a distinctcount somewhere, but i am not sure where.
Download the Pbix file here
I'd appreciate any help. Thanks!
Solved! Go to Solution.
This measure did the trick:
Filtered =
VAR FilteredData =
FILTER(
Data,
Data[Year] >= [Year Value]
)
VAR SummaryTable =
SUMMARIZE(
FilteredData,
Data[Country],
Data[Indicator],
Data[Series],
"YearCount", CALCULATE(DISTINCTCOUNTNOBLANK(Data[Year]))
)
VAR IndicatorSeriesWithMultipleYearsCount =
COUNTROWS( FILTER(SummaryTable, [YearCount] >= Years[Years Value]))
RETURN
IndicatorSeriesWithMultipleYearsCount
This measure did the trick:
Filtered =
VAR FilteredData =
FILTER(
Data,
Data[Year] >= [Year Value]
)
VAR SummaryTable =
SUMMARIZE(
FilteredData,
Data[Country],
Data[Indicator],
Data[Series],
"YearCount", CALCULATE(DISTINCTCOUNTNOBLANK(Data[Year]))
)
VAR IndicatorSeriesWithMultipleYearsCount =
COUNTROWS( FILTER(SummaryTable, [YearCount] >= Years[Years Value]))
RETURN
IndicatorSeriesWithMultipleYearsCount
Hi @horaciorek
Please try
IndicatorSeriesCount =
VAR FilteredData =
FILTER(
Data,
Data[Year] >= [Year Value]
)
VAR IndicatorSeriesCounts =
SUMMARIZE(
FilteredData,
Data[Indicator],
Data[Series],
"@YearCount", COUNTROWS(Data)
)
VAR IndicatorSeriesWithMultipleYearsCount =
COUNTROWS(
FILTER(
IndicatorSeriesCounts,
[@YearCount] >= [Years Value]
)
)
RETURN
IndicatorSeriesWithMultipleYearsCount
Thanks for your effort, but it doesn't seem to do the trick. With your measure, using the values I have in the image, it gives me 3 for both countries, when it should be 2 for Armenia...
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
11 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
13 | |
12 | |
11 | |
9 |