Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213916

New Column Doesn't Inherit Top-Level Filters

$
0
0

First off, please let me say thanks to all of you that have been posting solutions and helping folks on this forum.  I have read your posts with thanks as they have been helping me learn how to script in DAX (as much as I have been able to learn it so far).

 

Secondly, I'm having trouble getting Power BI to do what I think it should be doing, especially as I am trying to convert a client's excel spreadsheet model into a Power BI dashboard that allows some filters (aka slicers).

 

Question Up Front:  Do the top-level filters/slicers get passed to Columns or is there some specific way to reference the page-level filters from within the code below?

 

Many thanks in advance for your thoughts.

 

Here's the idea:

 

My client distributes medicine.  However, they want to be able to tracking rolling demand by downstream elements.  So, they want to be able to filter by the downstream vendor and medicine type (these are the slicers at the top level).

 

Here's the problem:

 

The filters don't seem to get passed to the column that I am trying to populate.  (code below)  When I enter data that is PRE-filtered from excel, the calculations and dashboard appear to display the numbers I would expect, meaning there is only one downstream vendor and one medicine type.

 

HOWEVER, when I try to run this code in the larger system, it goes haywire and isn't filtering as I thought it should.  I added some subsequent filters in the code below to limit only on the medicine type and downstream vendor and found that THOSE filters worked.  That told me the page-level filters were not making it into the code below when used within the larger data set.

 

RollingSumDemand = 
// set the variables to be used as the activity date and Average Days of Supply based on demand
VAR RowDate = Sheet1[activity_date]
VAR AverageDaysSupply = ROUNDUP(sum(Sheet1[Vials_On_Hand])/sum(Sheet1[Vials_Transfer_Out]),0)

RETURN
    CALCULATE (
		// add up the total lost sales and the total vials sold
        SUM ( Sheet1[Vials_Lost_Sales] ) + SUM ( Sheet1[Vials_Sold] ),
		// as bounded by "today" - which is the RowDate during the iterative process (part 1 before && below)
		// and "today" minus the AverageDaysSupply (part 2 after && below)
		FILTER (
            Sheet1,
            Sheet1[activity_date] > RowDate-AverageDaysSupply && Sheet1[activity_date] <= RowDate
        )
	)

Viewing all articles
Browse latest Browse all 213916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>