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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
andrmh
Helper II
Helper II

Allow a single visual to ignore report level filters

Hello all,

 

Im having an issue that I keep getting confused on, and suspect im making it alot harder than it needs to be.

 

I have a report containing two tables dimDate, and Workorders.

Dimdate is my date dimension and workorders is service work our techicians carry out.
They are joined on date (type date - not datetime), and created date (type date). Referential integrity is enforced.

 

The date dimenstion has a calculation of it that returns the MAX date, of the dates selected in the report filter.

The visual (below) displays 4 plots. All but the 4th - Total WorkOrder by MonthName Label, should obey the report date filter.

 

This 4th visual however, i want:

* take the MaxSelectedDate

* calculate a 'start date' that is 6 months prior to the MaxSelectedDate

* Then, using all data available to both tables, while observing the relationship of the join, show the 4th visual as just the 6 months from the MaxSelectedDate - 6months to MaxSelectedDate


So far using ALL, ALLSELECTED etc is just getting me in trouble, as i still want to observe the grouping on month/year established in the relationship, while ignoring the selection context. That said, I need maxselecteddate to dynamically build my range.....

I think i needs one, possibly 2 calculated tables here, but not sure how to go about it.

Any help is appreciated.

 

Capture.PNG

 

The graphic shown above is with ALL dates selected.

 

Thanks,

Andrew

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @andrmh,

 

You may need to duplicate the TestWorkorders table and keep the duplicated one unrelated to DimDate table.

 

In DimDate, add two calculated columns.

 

DateEnd = DimDate[Date]

DateStart = DATEADD(DimDate[Date],-6,MONTH)

 

 

And set their date format as below. Later, you should add [DateEnd] to report level filters.

1.PNG

 

Then, create new measures for the 4th chart based on the duplicated table,

 

Closed Work Orders2 = 
var maxDate = SELECTEDVALUE(DimDate[DateEnd])
var minDate = SELECTEDVALUE(DimDate[DateStart])

var totalWO = CALCULATE(
	CALCULATE(
	COUNTA('TestWorkOrders2'[WONumber]),
	'TestWorkOrders2'[WOState] IN { "CLOSED" }),
    filter(TestWorkOrders2, TestWorkOrders2[dateCreated]>=minDate&&TestWorkOrders2[dateCreated]<=maxDate) 
)

return
if(totalWO = BLANK(), 0, totalWO)


Completed Work Orders2 =
var maxDate = SELECTEDVALUE(DimDate[DateEnd])
var minDate = SELECTEDVALUE(DimDate[DateStart])

var totalWO = CALCULATE(
CALCULATE(
COUNTA('TestWorkOrders2'[WONumber]),
'TestWorkOrders2'[WOState] IN { "COMPLETED" }),
filter(TestWorkOrders2, TestWorkOrders2[dateCreated]>=minDate&&TestWorkOrders2[dateCreated]<=maxDate)
)

return
if(totalWO = BLANK(), 0, totalWO)

Total Work Order = [Closed Work Orders2] + [Completed Work Orders2]

 

Regards,

Yuliana Gu

 

 

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yulgu-msft
Employee
Employee

Hi @andrmh,

 

You may need to duplicate the TestWorkorders table and keep the duplicated one unrelated to DimDate table.

 

In DimDate, add two calculated columns.

 

DateEnd = DimDate[Date]

DateStart = DATEADD(DimDate[Date],-6,MONTH)

 

 

And set their date format as below. Later, you should add [DateEnd] to report level filters.

1.PNG

 

Then, create new measures for the 4th chart based on the duplicated table,

 

Closed Work Orders2 = 
var maxDate = SELECTEDVALUE(DimDate[DateEnd])
var minDate = SELECTEDVALUE(DimDate[DateStart])

var totalWO = CALCULATE(
	CALCULATE(
	COUNTA('TestWorkOrders2'[WONumber]),
	'TestWorkOrders2'[WOState] IN { "CLOSED" }),
    filter(TestWorkOrders2, TestWorkOrders2[dateCreated]>=minDate&&TestWorkOrders2[dateCreated]<=maxDate) 
)

return
if(totalWO = BLANK(), 0, totalWO)


Completed Work Orders2 =
var maxDate = SELECTEDVALUE(DimDate[DateEnd])
var minDate = SELECTEDVALUE(DimDate[DateStart])

var totalWO = CALCULATE(
CALCULATE(
COUNTA('TestWorkOrders2'[WONumber]),
'TestWorkOrders2'[WOState] IN { "COMPLETED" }),
filter(TestWorkOrders2, TestWorkOrders2[dateCreated]>=minDate&&TestWorkOrders2[dateCreated]<=maxDate)
)

return
if(totalWO = BLANK(), 0, totalWO)

Total Work Order = [Closed Work Orders2] + [Completed Work Orders2]

 

Regards,

Yuliana Gu

 

 

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

Wondering if GENERATE might be the answer here but won't know without sample data, etc. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thankyou Greg.

 

Ive shared a sample pbix.

Hopefully the link works.

 

https://www.dropbox.com/sh/caytzpevr91ycap/AAB9avk1EadFtMDnQ-fDTBVOa?dl=0

 

Additional note on the workings:

the first 3 visuals, and the title all operate on displaying data relevant to the MAX month end date selected in the report filters. ie, if you pick Dec 17, Jan 18, Feb 18, the visuals will display data for feb 18. Hence the formulas filtering on MaxSelectedDate.

 

for context, there will be subsequent pages that rely on the date filter.

 

 

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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