Forum Discussion

afcalderaro's avatar
afcalderaro
New Member
8 years ago
Solved

Exclude rows that have gaps in a time dimension

Hi, 

I have the following problem:

 

I have a hierarchy with 2 levels (could be more in a real situation):

Region and Line:

RegionLine
R1L1
R1L3
R2L2
R2L4

 

In a fact table I have the following situation:

 

ProdMonthRegionLineUptime
10/1/2017R1L110
11/1/2017R1L111
12/1/2017R1L112
1/1/2018R1L113
2/1/2018R1L114
3/1/2018R1L115
4/1/2018R1L116
5/1/2018R1L117
10/1/2017R2L220
11/1/2017R2L221
12/1/2017R2L222
1/1/2018R2L223
2/1/2018R2L224
3/1/2018R2L225
4/1/2018R2L226
5/1/2018R2L227
10/1/2017R1L330
11/1/2017R1L331
12/1/2017R1L332
1/1/2018R1L333
2/1/2018R1L334
3/1/2018R1L335
5/1/2018R1L337
10/1/2017R2L440
11/1/2017R2L441
12/1/2017R2L442
1/1/2018R2L443
2/1/2018R2L445
3/1/2018R2L446
5/1/2018R2L447

 

I need to calculate 6 month Trends for Uptime measure per Region.

But I need to include in the trends (lets suppose Avg(Uptime) just the Lines that have values for all 6 months.

In this case the trends for R1 should include just L1 and R2 just L2, because L3 and L4 have missing values for 4/1/2018.

How can I could achieve this? 

The initial month for the trend has to be choose by an slicer.

I tried to think in calculated tables, but those are not impacted by a slicer.

 

Thanks for any idea!

 

Regards, 

Alex

  • leverage on row context you will be able to exclude from calculation the item with missing data.

    As example you can use:

    CALCULATE(

    AVERAGE(Fact[KPI]), FILTER(SUMMARIZE(Fact,Fact[Line] ,"a",DISTINCTCOUNT(Fact[ProdMonth])),[a]=CALCULATE(DISTINCTCOUNT(Fact[ProdMonth]),all(Fact[Line]))

    )

    )

2 Replies

  • leverage on row context you will be able to exclude from calculation the item with missing data.

    As example you can use:

    CALCULATE(

    AVERAGE(Fact[KPI]), FILTER(SUMMARIZE(Fact,Fact[Line] ,"a",DISTINCTCOUNT(Fact[ProdMonth])),[a]=CALCULATE(DISTINCTCOUNT(Fact[ProdMonth]),all(Fact[Line]))

    )

    )