Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
HansButenschon
New Member

How to Omit part of time series for one department

We have a model where we have some outlier-values in a measure for one department until a given date. We want to keep the values in the model, but hide them from one of the visuals.

 

2022-06-24_16-11-43.png

Basically I try to express a condition:

 

 

FilterTest = if(Sheet1[Department] = "New Haven" && Sheet1[Date] < 08/01/2021, 0, 'Key Measures'[SumXvalue])

 

 

... hoping that this will give me nothing for New Haven until August 2021 and the original value for all other departments, including for New Haven from August 2021 onwards.

 

 I have tried various IF, SWICTH, CALCULATE and FILTER combos, but always end up with an error: 

A single value for column 'Department' in table 'Sheet1' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

 

The value we are working with in the real case is the result of a complex calculation (two 12-month rolling averages divided by eachother) so I cannot just omit the value from the underlying query.

 

I have uploaded a small pbix-file that illustrates the essence of the problem. Link to PBIX-file 

 

Any suggestions would be highly appreciated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI

 

I create a new table with a date giving the start date you want to show results for each department 

DepartmentDate
Madrid01/01/2018
Copenhagen01/01/2018
New Haven01/07/2021

and after i changed your measure

FilterTest =

var dategraph = min(Sheet1[Date])
var site= SELECTEDVALUE(Sheet1[Department])
var datemin=LOOKUPVALUE(Date_Afich[Date],Date_Afich[Department],site)

var result = if(dategraph>datemin,[SumXvalue])
return
result
JamesFr06_0-1656085220956.png

Hope this will help you

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI

 

I create a new table with a date giving the start date you want to show results for each department 

DepartmentDate
Madrid01/01/2018
Copenhagen01/01/2018
New Haven01/07/2021

and after i changed your measure

FilterTest =

var dategraph = min(Sheet1[Date])
var site= SELECTEDVALUE(Sheet1[Department])
var datemin=LOOKUPVALUE(Date_Afich[Date],Date_Afich[Department],site)

var result = if(dategraph>datemin,[SumXvalue])
return
result
JamesFr06_0-1656085220956.png

Hope this will help you

Thank you very much! This worked and has now been implemented in the main model. Also served as an illustration on how we can share ideas and solutions in the forum. Great!

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors