Filtering data already filtered using DAX

Hi there
I am using DAX to calculate the count of instances in a filtered table
e.g.
=CALCULATE( COUNT(Table[Tariff] ,
FILTER( Table , Table[Tariff] > 0 )
This part of the code works fine. My trouble arises when I am trying to filter the table that I have already filtered:
=CALCULATE( COUNT(Table[Tariff] ,
FILTER ( FILTER( Table , Table[Tariff] > 0 ) , Table[Tariff] = MIN(Table[Tariff]) )
In the above calculation, I want to 
1. Filter out the tariffs that are greater than zero [this bit works fine]; and then
2. Take that table filtered from 1. above and further filter that by extracting only those tariffs that are equal to the minimum in that data table [this part isn't working].
Instead of doing what I need it to, this formula is treating the outer FILTER in the same manner that it would be treated if I had only one filter. Thus, as zero is the minimum in the unfiltered data set it is only returning all the zero tariffs - even through
I filtered these out already.
If anyone can please assist, it would be much appreciated.
Cheers
Andrew

Hi Andrew,
Something along these line may work...
=CALCULATE(
SUM(TariffData[Tariff])/COUNT(TariffData[Tariff]),
FILTER(
FILTER(
TariffData,
TariffData[BEGIN_DATE_INDEX] <= [Date_Count]
&& TariffData[END_DATE_INDEX] >= [Date_Count]
TariffData[Tariff_Duration] = CALCULATE(
MIN(TariffData[Tariff_Duration]),
FILTER(
TariffData,
TariffData[BEGIN_DATE_INDEX] <= [Date_Count]
&& TariffData[END_DATE_INDEX] >= [Date_Count]
...But it's likely that you'll need to adjust the inner most CALCULATE to get the right behaviour due to the filter context transition. If you're able to provide some test data and details of how the data has been modelled, we should be able to arrive at
a solution that definitely works.
Regards,
Michael Amadi
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to vote it as helpful :)
Website: http://www.nimblelearn.com
Blog: http://www.nimblelearn.com/blog
Twitter: @nimblelearn

Similar Messages

  • Data Validation/Filtering Using SmartView

    Hi,
    I just want to know that how can i apply Data Validation/filtering in SmartView.
    For E.G if i want that Only those combination should be Shown where the Value of a Product is Always Greater than 2000.
    Please help out
    Thanks in Advance

    Well, yes it is true you can write MDX for it but that isn't what you asked is it?
    If you look at the Tech Ref
    http://docs.oracle.com/cd/E17236_01/epm.1112/esb_tech_ref/frameset.htm?launch.html
    and search for IIF there is an example there that should point you in the right direction.
    WITH MEMBER
    [Scenario].[Revised Budget]
    AS
    'IIF (
    [Product].CurrentMember.Caffeinated,
    Budget * 1.1, Budget
    SELECT
    {[Scenario].[Budget], [Scenario].[Revised Budget]}
    ON COLUMNS,
    [Product].Levels(0).Members
    ON ROWS
    FROM Sample.Basic
    WHERE ([Measures].[Sales], [Year].[Qtr3])
    Otherwise I might post a new question asking for someone to help you optimise an MDX query.
    Steve

  • Obiee 11g : Best practice for filtering data allowed to user

    Hi gurus,
    I have a table of the allowed areas for each user.
    I want to show only the data facts associated with these allowed areas.
    For instance my user scott can see France and Italy data.
    I made a variable session. I put this session variable in a filter.
    It works ok but only one value (the first one i think) is taken in account (for instance, with my solution scott will see only france data).
    I need all the possible values.
    I tried with the row wise parameter of the variable session. But it doesn't work (error obiee).
    I've read things on internet about using stragg or valuelistof but neither worked.
    What would be the best practice to achieve this goal of filtering data with conditions by user stored in database ?
    Thanks in advance, Emmanuel

    Check this link
    http://oraclebizint.wordpress.com/2008/06/30/oracle-bi-ee-1013332-row-level-security-and-row-wise-intialized-session-variables/

  • 'select expert' option is not filtering data in CR, in VS2012

    ,Hi,
    We have a VB  VS2005 crystal report application , is working good with ' select expert ' option for filtering data in side crystal report. When we are migrated the application to VS2012, the application is not filtering the data inside crystal report. I could see the 'select expert ' options and Formula editor code in VB 2012 exactly same as VB 2005. But, there is no data filtering in Crystal Report. Please help. We are using Crystal report developer version for VS2012.  My formula editor code inside CR 'select expert' is {REPORT.CODE} in ["3102",  "4010"]

    Hi George
    Please see if KBA 1204895 - Selection formula is ignored when using Crystal Reports 2008 and VS .NET 2005 helps to resolve the issue.
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
      Follow me on
    Twitter

  • Problem with filtering data

    Hi!
    I'm having trouble with filtering data from my table and don't know how to resolve it properly.
    I created a tabular form my table, a few text fields that are used as input for different columns of the filter and a filter button that submits the page.
    The problem appeared when I try to filter a column that has null values in the table and is editable...that's as far as I have concluded.
    So when I press the button I get zero rows even though there should be some.
    This is the submitted query:
    select
    "MSR_PRD_ID",
    "SRC_STM_ID",
    "ID",
    "ISIN",
    from "#OWNER#"."IZV_SLOG_DET"
    WHERE
    lower(MSR_PRD_ID) = lower(nvl(:P7_X_MSR_PRD_ID,MSR_PRD_ID)) and
    lower(SRC_STM_ID) = lower(nvl(:P7_X_SRC_STM_ID,SRC_STM_ID)) and
    lower(ISIN) = lower(nvl(:P7_X_ISIN,ISIN)) and
    The nvl function is used so that if the user leaves the field empty it only filters by the fields that have input.
    Does anyone know how I could circumvent this?
    Regards,
    Ivan

    LOWER (NVL (ISIN,'Y')) = LOWER (NVL (:P7_X_ISIN, LOWER (NVL (ISIN,'Y'))))
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    https://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494

  • Link to summary report with filtered data set within FormsCentral

    Is it possible to generate a link to a summary report with a filtered data set within FormsCentral?
    If I have 4 sales agents each using the form to submit their repsective sales (with a dropdown indicating the sales agent) is it possible to filter the data so that only Sales Agent A see a report of their sales?
    Thanks,
    D

    Try following forum:
    http://forums.adobe.com/community/formscentral?view=discussions

  • How to return efficiently filtered data

    Dear all,
    I have a database ( SQL server 2012) which is based from AW sample db where I took some sample table design to cover my issues.
    My database will host a big list of product organized in category and sub category. From my client application I will provide a FIlter UI where user can defined filter criteria like Price, category name, sub category, name for instance.
    I need to build a querry based on given criteria in order to return filter data in an efficient way. In order to get correct data back, based on db structure I will have to handle quite many joins.
    What is the proper way to get filtering data out ?
    -should I handle it from a single store procs and return the list of matching product ?
    -should I handle separate view for each criteria and merge them all in a single view ?
    - Any build in feature in SQL ?
    I have never use such efficient criteria constraint that I need to implement, thanks for help
    regards

    I think you need read Erland's great article
    http://www.sommarskog.se/dyn-search-2008.html
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Filtered data has to show in X axis

    Would you please guide me how to get the dynamic filtered data in column chart x axis ?
    1. I have 7 columns.
    2. Using filter component with 4 data filters
    3. Remaining 3 values 2 columns will be Y axis n 1 will be X axis
    (which is dynamic)
    4. X axis , I am able retrieve one record not all
    (some of the filter I have two more data / records).
    Please find the attached .xlf with .xls files (attcahed files are in compressed mode). I don't khow, how to upload the source
    Happy to discuss
    Edited by: stsrin on Jan 5, 2010 9:00 AM
    Edited by: stsrin on Jan 5, 2010 9:00 AM

    I was able to figure this out.
    When we use Just textRotation = "TR_HORIZ_ROTATE_90" This wouldn't work. we need to include automaticRotation = "AR_NO_ROTATE"
    Used this and it worked.
    <O1TickLabel textRotation="TR_HORIZ_ROTATE_90" automaticRotation="AR_NO_ROTATE" />

  • HOW TO GET FILTERED DATA

    HI All,
    I have an query, i have data like how to get filtered data
    i have data like below
    we have started this report with below data for Oct 2014 to Dec 2014
    QUARTER
    STATE
    COUNT
    Oct 2014 - Dec 2014
    U.P
    70
    Oct 2014 - Dec 2014
    M.P
    0
    Oct 2014 - Dec 2014
    BIHAR
    3
    Oct 2014 - Dec 2014
    MAHA
    50
    Oct 2014 - Dec 2014
    RAJ
    3
    so it was very easy to generate report
    then we get data for Jan 2014 to March 2014
    QUARTER
    STATE
    COUNT
    Oct 2014 - Dec 2014
    U.P
    70
    Oct 2014 - Dec 2014
    M.P
    0
    Oct 2014 - Dec 2014
    BIHAR
    3
    Oct 2014 - Dec 2014
    MAHA
    50
    Oct 2014 - Dec 2014
    RAJ
    3
    Jan 2014 - Mar 2014
    U.P
    77
    Jan 2014 - Mar 2014
    M.P
    1
    Jan 2014 - Mar 2014
    BIHAR
    4
    Jan 2014 - Mar 2014
    MAHA
    77
    Jan 2014 - Mar 2014
    RAJ
    5
    so we applied filter on quarter manually for generating the report
    now we have data like below
    QUARTER
    STATE
    COUNT
    Oct 2014 - Dec 2014
    U.P
    70
    Oct 2014 - Dec 2014
    M.P
    0
    Oct 2014 - Dec 2014
    BIHAR
    3
    Oct 2014 - Dec 2014
    MAHA
    50
    Oct 2014 - Dec 2014
    RAJ
    3
    Jan 2014 - Mar 2014
    U.P
    77
    Jan 2014 - Mar 2014
    M.P
    1
    Jan 2014 - Mar 2014
    BIHAR
    4
    Jan 2014 - Mar 2014
    MAHA
    77
    Jan 2014 - Mar 2014
    RAJ
    5
    Apr 2014 - Jun 2014
    U.P
    186
    Apr 2014 - Jun 2014
    M.P
    18
    Apr 2014 - Jun 2014
    BIHAR
    74
    Apr 2014 - Jun 2014
    MAHA
    189
    Apr 2014 - Jun 2014
    RAJ
    68
    now as per new requirement they want only this quarter data of Apr 2014 to Jun 2014
    Apr 2014 - Jun 2014
    U.P
    186
    Apr 2014 - Jun 2014
    M.P
    18
    Apr 2014 - Jun 2014
    BIHAR
    74
    Apr 2014 - Jun 2014
    MAHA
    189
    Apr 2014 - Jun 2014
    RAJ
    68
    and requirement like we have to automate this process . means report should contain only current quarter value.
    so my  query is how to achieve this
    please suggest
    I am using SAP BO 3.1
    Thanks in advance
    Jeet 

    Hi Jeet,
    You can try this-
    Create variable
    V_Quarter= if Left(<QUARTER>,3)="Jan" then 1 elseif Left(<QUARTER>,3)="Apr" then 2 elseif Left(<QUARTER>,3)="Jul" then 3 else 4
    V_Year= Right(<QUARTER>)
    V_CurrQuarter=Quarter(CurrentDate())
    V_CurrYear=Year (CurrentDate())
    Apply filter on report
    V_Quarter= V_CurrQuarter and V_Year=V_CurrYear
    -Anuj

  • Extracting Filtered Data

    Hi,
    I have a sheet in Numbers which I have filtered to show only fields with a certain value. I want to copy these separated fields into a new sheet, but the copy and paste function only throws back the unsorted data. How can I extract filtered data to copy to another sheet?
    Thanks!
    Jim

    KOENIG Yvan wrote:
    Only an advice.
    Numbers developers thought that the available feature is matching the Apple Human Interface Guidelines requirements.
    Often, building a program is not a problem of competence but a problem of choice. The authors must define the needs of the target customers. Your hopes doesn't match these needs no more no less.
    Judging by some of the similar questions on this forum I would disagree - not all people want to use Numbers for high-end data processing! I, for example, am using it to compile my tax return, including earnings from multiple countries. The fact that it comes bundled as part of a home computer package would suggest to me that Apple have a broader market in mind than only those who have to manipulate data professionally.
    I'm quite intelligent enough to learn how to use this program; it's more a matter of the time I had to spend in trying to complete what I felt to be a relatively simple task. I can't believe that even for those who fall into your category of 'target customers', having continually to write long function scripts is welcome - even when clearly as competent as you are in doing so!
    Thanks to your kind help I've been able to accomplish what I needed, but I still feel that for such a simple task as filtering data and extracting it to another sheet Apple are, for once, falling somewhat short of their user-friendly reputation.

  • My back up failed and I get a messageTime Machine couldn't complete the backup to "TimeCap".  The backup disk image "/Volumes/Data/Mary Fleming's MacBook Pro .sparsebundle" is already in use.

    I noticed today that my last back-up was this a.m. and it has tried several times to back up since but I keep getting this message
    Time Machine couldn’t complete the backup to “TimeCap”.
    The backup disk image “/Volumes/Data/ MacBook Pro ."sparsebundle” is already in use.
    I have never had this problem before and don't know what to do. I am not that great around computers so if anyone can help I would appreciate it. I did try to do some research but could not understand any of the content I read. I sure don't know what "sparsebundle" is and this is the first time I ever heard the term.
    If anyone can help woold appreciate it.
    I have Version 10.9.1

    This is a standard issue..
    Been around since LION but you missed out.. !! Well the old rule applies.. there are three types of Mac users.
    1. The bugs have bitten you, and you have done the work arounds.
    2. The bugs are biting you and you are now trying to find out what is going on.
    3. The bugs will bite you. And in the meantime you laugh at everyone with problems and say it must be all their fault. Doesn't happen to my system. 
    You were simply in the last group.. now, with the wonders of mavericks to help, you got bit.
    The solution is simple.. unplug the power cord from the TC .. count to 10.. power up the TC again.
    No luck look at the more technical help.
    C12 here. http://pondini.org/TM/Troubleshooting.html
    Your naming might also be an issue if this continues to happen.. see C9.

  • I cannot log in my game center using a same nickname after i updated my phone to ios 7. All my game data i was playing for months is lost. Seems when i try to put my nickname its already in used. How can i recover all my game data back?

    All my game data i was playing for months was lost. Seems when i trie to put my nickname its already in used. So i need to put a new nickname then it create a whole new acc for me. All my previous data was lost. How can i recover my all my data or use my old nickname? Pls help  

    kerryp123
    Yes, it is the same with me. I know a friend how upgraded to iso7 and lost all of his game center data. He tried singning in and re singning in but no change. Plus on to of all of this, apple is like have me and him to re-validate our itunes acount. Somthing weried is going on. So verified my itunes acount and it shows under settings that I am signed in, but when I go to  the app store on my iPhone and try downloading or even updating a app, it says "can not conect to itunes store" after singing in! AND I'M NOT SURE I AM GOING TO UPGRADE TO ISO7 YET UNTILL THEY FIX THIS BUG!!!! HELP!

  • MacPro backed up to Time Machine, added Mac Mini now get "The backup disk image "/Volumes/Data/Jerry Booher's MacBook Pro.sparsebundle" is already in use." error when Mac Pro tries to back up

    MacPro backed up to Time Machine, added Mac Mini now get "The backup disk image “/Volumes/Data/Jerry Booher’s MacBook Pro.sparsebundle” is already in use." error when Mac Pro tries to back up

    It is standard Mountain Lion error due to the networking ability which is comparable to wet string. (actually that was lion.. it dried out some with Mountain Lion.. higher in the hills perhaps!!)
    See C12 and C17
    http://pondini.org/TM/Troubleshooting.html
    But many people are suffering the same issue..
    And the above is even a little out of date.. you might need to do a reset to the TC.
    Welcome to Apple's beta program for everyone.

  • I get this error message when I try to back up my laptop:  Time machine could not complete the backup.  The backup disc image "/Volumes/Data/Lou Ann Buesing's Mac Book Pro. sparse bundle is already in use.  Anyone know how to fix it?

    I get this error message when I try to back up my laptop:
    ' Time machine could not complete the backup.  The backup disc image "/Volumes/Data/Lou Ann Buesing's Mac Book Pro. sparse bundle' is already in use. "
    Anyone know how to fix it?

    Reboot the TC.. Sometimes you need to reboot the whole network.
    This is what comes of Lion and then made worse in Mountain Lion of Apple not spending enough time to fix the bugs.
    Read C12 in pondini.
    http://pondini.org/TM/Troubleshooting.html
    C17 can be related I think.

  • HT3275 My time machine does not back up and giving me this error message: The backup disk image "/Volumes/Data-1/Amiel's MacBook Pro.sparsebundle" is already in use. Pls help.

    My time machine does not back up and giving me this error message: The backup disk image “/Volumes/Data-1/Amiel’s MacBook Pro.sparsebundle” is already in use. Pls help.

    Make sure that there are no other Macs backing up at the present time.
    Pull the power cord from the back of the Time Capsule
    Count to ten
    Plug the power cord back in
    This will "fix" things about 98% of the time. Post back if you are in the unlucky 2% category.

Maybe you are looking for