Tabular DAX Query for MINX, MAXX and AVGX

Hi,
I need to create three measure to get value of min, max and avg.
For example, I have 3 columns in my table. I need to take minimum value of Column3 based on column2. If column2 value is 0, then we have to consider entire table data else only we have to consider
Column1 Column2 Column3
AAA         1      150
BBB         1       50
CCC         0       25
DDD        1        40
EEEE        0        70
I need to take minimum,maximun and avg value of Column3 based on column2. If column2 value is 0, then we have to consider entire table data. IF column2 value is 1, then only we have to consider the row of column2=1.
I expect the result as like below. Can you please help to find the DAX query for the measure.
Column1 Column2 Column3  MinValue
AAA         1      150            40
BBB         1       50             40
CCC         0       25             25
DDD        1        40             40
EEE         0         70            25
EEE         0         70

Hi,
I have 3 columns in my table. I need to take minimum value of Column3 based on column2. If column2 value is 0, then i have to consider entire table data else only i have take minimum(column3) by considering rows of column2=1.
Column1 Column2 Column3
AAA         1      150
BBB         1       50
CCC         0       25
DDD        1        40
EEEE        0        70
Try1:
Min:=IF(Column2>0,MINX(FILTER(table,[column2]>0),[column3]),Min(Column3))
Try2:
Min:=MINX(IF(Column2>0,FILTER(table,[column2]>0),table),[column3]))
Try3:
Created Measure called Min1.
Min1:=MINX(FILTER(Table,[Column2]>0),[Column3])
And then i made this min1 measure to be hidden.
Created another measure called Min2.
Min2:=IF(ISBLANK([Min1]),MIN([column3]),[Min1])
Both DAX query is not working. Can anyone help to have the correct DAX query to create Min measure based on the conditions.

Similar Messages

  • Can we combine Query for cancelled requisitions and query for internal requisitions without internal sales order into a single query

    Hi All,
    Greetings.
    I have two queries namely,
    1.Query for cancelled requisitions and
    2.Query for Internal Requisitions without Internal Sales Orders.
    I was on a task to combine those two queries..
    Can we do that? if so, please help me do that..
    Thanks in Advance,
    Bhaskar.

    Hi All,
    Greetings.
    I have two queries namely,
    1.Query for cancelled requisitions and
    2.Query for Internal Requisitions without Internal Sales Orders.
    I was on a task to combine those two queries..
    Can we do that? if so, please help me do that..
    Thanks in Advance,
    Bhaskar.

  • Media query for iPhone 4s and iPhone 5

    What is the Media Query for iPhone 4s and iPhone 5 in landscape and portrait mode

    This is a tech support forum.  For developer and coding questions, post in the Dev forums

  • Query for the FULL AND FINAL SETTLEMENT REPORT

    Hi,  any one  has the query for the FULL AND FINAL SETTLEMENT REPORT in oracle hrms??

    Hi,
    I go through that .class file and find that they have used below package in that.
    PAY_IN_TERM_RPRT_GEN_PKG
    Hope this will help you.

  • Same Query for both Main and Sub Report

    I have a report whichs works but I don't think i'm getting the data to both the Main Report and Sub Report in the most effcient manner...  I have a report that totals users call subject counts.  But then end user wishes to see all users total counts and the grand totals of call counts on the first page then then the breakdown of types of calls on subsuquent pages...  so I created a report with a subreport in the report header....  I use the same query in both the sub and main report... however it asks the user to enter the parameters once for the main report and once for the sub report... Parameters are both the same for each; month and year...  so it currently runs the query twice I want to run it once and use the data for both reports...  I group by name and then sum the call subject counts for the user totals... and in the sub report I hide the detail section and I'm just left with the sub total line for each user, then in the main report use the same grouping and suming again and I start a new page for every user... 
    Using CR 9
    Thanks for any advice
    Vincent

    i think you need to link the main report parameter with the subreport parameters inorder to pass the parameter values from main report to subreport. So right click on subreport and go to change subreport links and add parameter fields and select parameter fields from your subreport and un check the databse fields in subreport.
    Regards,
    Raghavendra.G

  • Query for month start and end date

    Hi,
    I want to pick every month Start date and End Date. could anybody suggest what is the query for this.
    I need output
    Start Date End Date
    01/01/2011 31/01/2011
    01/02/2011 28/02/2011
    01/03/2011 31/03/2011
    01/04/2011 30/04/2011
    01/05/2011 .......

    Hi,
    SQL> select sysdate from dual;
    SYSDATE
    24-FEB-11
    SQL> select last_day(sysdate) from dual;
    LAST_DAY(
    28-FEB-11
    SQL> select last_day(sysdate),last_day(add_months(sysdate,-1))+1 from dual;
    LAST_DAY( LAST_DAY(
    28-FEB-11 01-FEB-11
    SQL> select last_day(sysdate),last_day(add_months(sysdate,-2))+1 from dual;
    LAST_DAY( LAST_DAY(
    28-FEB-11 01-JAN-11Try to refer to Oracle documentation and try to experiments the functions, you will get results on your hand.
    - Pavan Kumar N
    Edited by: Pavan Kumar on Feb 24, 2011 12:51 PM
    Edited by: Pavan Kumar on Feb 24, 2011 12:52 PM

  • Query for oracle 9i and 10g on same box

    HI
    All,
    I have oracle 9i installed on one box it has
    oracle home /u01/app/oracle/product/9.2.0
    and i am gonna install oracle 10g on different home /u01/app/oracle/product/10.2.0
    Do I need to specify different location for OraInventory?
    so what else I need to take care?
    Thanks,
    Vishal

    So there should not be a problem if it is the same
    orainventory location for both 9i and 10g right.There should be no problem.
    can you throw more focus on below ?
    When managing different oracle versions on the same
    box you should take care of environment variables to
    properly point to each ORACLE HOME and PATH, and
    ensure different ports do not conflict.
    For instance, you should use the Listener of the latest release on the server (in this case 10g) to services all the databases on that box 9both 9i and 10g).
    When you want to startup and shutdown 9i database, you do not want to shutdown a 10g database by mistake. Hence, setting things like ORCLE_HOME and ORACLE_SID.
    Also, Oracle Server make use of libraries. You do not want to mix up 9i and 10g libraries. hence take care when you set things like PATH, LD_LIBRARY_PATH etc
    The same applies to all Environment variables you want to set on the server that has different oracle releases. You just need to ensure that when you logon, your variables are set correctly for the intended oracle release before you do anything.

  • Query for get username and profile and password life time

    please provide query for this output
    Profile     Username     Password Life Time
    DEFAULT     APPQOSSYS     UNLIMITED days
    DEFAULT     CZ36QW     UNLIMITED days
    DEFAULT     DBSPI     UNLIMITED days
    please tell me Password Life Time in this col um shows empty.

    please provide query for this output
    Profile     Username     Password Life Time
    DEFAULT     APPQOSSYS     UNLIMITED days
    DEFAULT     CZ36QW     UNLIMITED days
    DEFAULT     DBSPI     UNLIMITED days
    please tell me Password Life Time in this col um shows empty.

  • PowerPivot DAX support for Quantile (Percentile and Quartile)

    Hello,
    I recently needed to use create a DAX Measure that would return the Percentile of my serie but hit a wall as the percentile function was nowhere to be seen.
    Thanks to Frankie Yuen
    post and Marco Russo's
    post about the MEDIAN, i found a way to compute the percentile as such :
    MINX(FILTER(VALUES(MyDataSerie1[Col1]),
    CALCULATE(COUNTROWS(MyDataSerie1),
    MyDataSerie1[Col1] <= EARLIER(MyDataSerie1[Col1]) )
    > COUNTROWS(MyDataSerie1)*0.9),
    MyDataSerie1[Col1])
    It's working quite well so far but it is just so frustrating to use such a complex template for something that seems so common.
    Have I missed a function that would allow me to compute quantiles easily ? Do you have other suggestions ?
    Regards,
    Jonathan

    The pattern described in this article should work with both odd and even data sets:
    http://www.daxpatterns.com/statistical-patterns/
    Marco Russo (Blog,
    Twitter,
    LinkedIn) - sqlbi.com:
    Articles, Videos,
    Tools, Consultancy,
    Training
    Format with DAX Formatter and design with
    DAX Patterns. Learn
    Power Pivot and SSAS Tabular.

  • Query for Sales order and corr.AR Invoice Info

    Hi,
    I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
    Sales Order columns reqd:
    OPERATING_UNIT
    ORDER_NUMBER
    CUSTOMER_NUM
    CUSTOMER_NAME
    ORDERED_DATE
    FLOW_STATUS_CODE
    TOTAL_ORDER_AMOUNT
    AR invoice columns reqd for the sales orders:
    Invoice number,
    Invoice date,
    Invoice Total.
    Can anyone help me out with this?
    Thanks,
    Ash

    Hi Ash,
    There are some issues that must be defined before you have the exact query.
    Do you have freight charges or non-inclusive tax? If you have, freight charges and tax amounts must be included?
    Depending on you grouping rule, you can have lines from more than one order in a single invoice. In this case, as invoice amount you want the sum of all lines, or only the lines from that order?
    Below is an example using two views. It assumes that grouping rules split lines from different order into different invoices.
    Hope it helps,
    Ketter Ohnes
    create or replace view order_summary as
    select oh.org_id,
    oh.ORDER_NUMBER,
    oh.header_id,
    ott.name tt_name,
    ca.account_number,
    p.party_name,
    oh.ordered_date,
    oh.flow_status_code,
    sum(ol.ordered_quantity*ol.unit_selling_price) total,
    sum(ol.tax_value) tax,
    (select sum(operand)
    from OE_PRICE_ADJUSTMENTS_v x
    where x.header_id = oh.header_id
    and x.adjustment_type_code='FREIGHT_CHARGE') freight_charge
    from oe_order_headers_all oh,
    oe_order_lines_all ol,
    hz_cust_accounts ca,
    hz_parties p,
    oe_transaction_types_tl ott
    where ol.header_id=oh.header_id
    and oh.sold_to_org_id = ca.cust_account_id
    and ca.party_id = p.party_id
    and oh.order_type_id = ott.transaction_type_id
    and ott.language =
    (select language_code
    from fnd_languages
    where installed_flag = 'B')
    group by oh.org_id,
    oh.header_id,
    oh.ORDER_NUMBER ,
    ott.name,
    ca.account_number,
    p.party_name,
    oh.ordered_date,
    oh.flow_status_code;
    create or replace view invoice_summary as
    select a.interface_header_context,
    a.trx_date,
    a.trx_number,
    b.interface_line_attribute1,
    b.interface_line_attribute2 tt_name,
    a.customer_trx_id,
    sum(b.extended_amount) invoice_total
    from ra_customer_trx_all a,
    ra_customer_trx_lines_all b
    where a.customer_trx_id = b.customer_trx_id
    and b.interface_line_context = 'ORDER ENTRY'
    and b.line_type in ('LINE','FREIGHT')
    group by a.interface_header_context,
    a.trx_date, a.trx_number,
    b.interface_line_attribute1,
    b.interface_line_attribute2,
    a.customer_trx_id;
    select *
    from order_summary o,
    invoice_summary i
    where o.order_number between :1 and :2
    and o.order_number = i.interface_line_attribute1
    and o.tt_name = i.tt_name;

  • Query for Sales Order and AR Invoice Information

    Hi,
    I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
    Sales Order columns reqd:
    OPERATING_UNIT     
    ORDER_NUMBER     
    CUSTOMER_NUM     
    CUSTOMER_NAME     
    ORDERED_DATE     
    FLOW_STATUS_CODE     
    TOTAL_ORDER_AMOUNT
    AR invoice columns reqd for the sales orders:
    Invoice number,
    Invoice date,
    Invoice Total.
    Can anyone help me out with this?
    Thanks,
    Ash

    Hi Ash,
    Table RA_CUSTOMER_TRX_ALL can be joined to RA_CUSTOMER_TRX_LINES_ALL table through CUSTOMER_TRX_ID column. The table RA_CUSTOMER_TRX_LINES_ALL.INTERFACE_LINE_ATTRIBUTE6 = OE_ORDER_LINES_ALL.LINE_ID. And from the LineId, you can get the HeaderId os the OE_ORDER_HEADERS_ALL table.
    You must have visualized the query by now.
    Thanks
    Sumit

  • How to write the query for year revenue and avg

    Hello Team
    I have the table
    create table sale (sale_id varchar2(32) not null, sale_epoch_microsec numeric(18,0)
          not null, sale_amount_cents numeric(18,0) not null, customer_id varchar2(32)
          not null, industry_id varchar2(32) not null, product_id varchar2(32) not null)The industry the customer is considered to be in can change from sale to sale. sale_epoch_microsec is microseconds since epoch; sale_amount_cents is the value of the sale in pennies.
    The data in this is:
    Insert into SALE
       (SALE_ID, SALE_EPOCH_MICROSEC, SALE_AMOUNT_CENTS, CUSTOMER_ID, INDUSTRY_ID,
        PRODUCT_ID)
    Values
       ('s1', 200000000, 69985484589459, 'c1', 'i1',
        'p1');
    Insert into SALE
       (SALE_ID, SALE_EPOCH_MICROSEC, SALE_AMOUNT_CENTS, CUSTOMER_ID, INDUSTRY_ID,
        PRODUCT_ID)
    Values
       ('s2', 200000000, 69985484589459, 'c2', 'i2',
        'p2');
    Insert into SALE
       (SALE_ID, SALE_EPOCH_MICROSEC, SALE_AMOUNT_CENTS, CUSTOMER_ID, INDUSTRY_ID,
        PRODUCT_ID)
    Values
       ('s3', 6579000000, 6.99675342390895E16, 'c3', 'i3',
        'p3');
    Insert into SALE
       (SALE_ID, SALE_EPOCH_MICROSEC, SALE_AMOUNT_CENTS, CUSTOMER_ID, INDUSTRY_ID,
        PRODUCT_ID)
    Values
       ('s4', 6.5866459684979E17, 6.99675343454391E17, 'c4', 'i4',
        'p4');
          1.) SQL: Write the SQL query to determine, year-over-year, the total revenue and avg. per-product revenue from customers in the 'Gaming' industry.

    josh1612 wrote:
    As in the question it's mentioned that the date is in microseconds,
    So i need the guidence to convert that to the date .Convert microseconds to seconds and then you may be able to use the function below which was found here:
    http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_dates.html
    CREATE OR REPLACE
        FUNCTION unixts_to_date(unixts IN PLS_INTEGER) RETURN DATE IS
             * Converts a UNIX timestamp into an Oracle DATE
            unix_epoch DATE := TO_DATE('19700101000000','YYYYMMDDHH24MISS');
            max_ts PLS_INTEGER := 2145916799; -- 2938-12-31 23:59:59
            min_ts PLS_INTEGER := -2114380800; -- 1903-01-01 00:00:00
            oracle_date DATE;
            BEGIN
                IF unixts > max_ts THEN
                    RAISE_APPLICATION_ERROR(
                        -20901,
                        'UNIX timestamp too large for 32 bit limit'
                ELSIF unixts < min_ts THEN
                    RAISE_APPLICATION_ERROR(
                        -20901,
                        'UNIX timestamp too small for 32 bit limit' );
                ELSE
                    oracle_date := unix_epoch + NUMTODSINTERVAL(unixts, 'SECOND');
                END IF;
                RETURN (oracle_date);
        END;

  • Ad-Hoc Query for OU's and their Cost Center

    Cost Centers are often inherited from parent OU's. If I try to make an Ad-Hoc query, select some OU's and show the Cost Centers via the relationship A11, the fields are empty unless the Cost Center is hardcoded for the OU.
    Is there a way to create an Ad-Hoc query that shows the Cost Centers even if they are inherited? I can't make any changes to system tables or other customizing.
    Thanks in advance!

    Unfortunately I'm not authorized to use SE16.
    This is my selection:
    Object ID: xxx (Selection)
    Object Type: O (Selection)
    Plan Version: 01 (Selection)
    Relationship Between Objects: 011 (IT1001)
    Relationship Specification: A (IT1001)
    Type of Related Object: K (IT1001)
    Output:
    Object ID (IT1000)
    Object Abbreviation (IT1000)
    Object Name (IT1000)
    ID of Related Object (IT1001)
    Any other way?

  • Looking collection query for WMI Issue and obsolete computer list

    Hi 
    I want to create collection based on client having below issue.
    WMI Issue and obsolete 
    in one query.
    Kindly paste it

    hi Gokul,
    If you install the client status reporting tool on your environment its easy to find out the client health issues with a report and  for the obsolete entry query
    Client status reporting tool use http://technet.microsoft.com/en-us/library/cc161853.aspx
    http://rajsavi.wordpress.com/2012/08/20/installation-and-configuration-of-client-status-reporting-tool-for-sccm/
    WQL for duplicate entry:
    http://eskonr.com/2012/10/sccm-collectionreport-duplicate-computer-names-with-different-resource-id/
    Kamala kannan.c| Please remember to click “Mark as Answer” or Vote as Helpful if its helpful for you. |Disclaimer: This posting is provided with no warranties and confers no rights

  • Need SQl Query for Revenue Code and Revenue Amount in Receivables

    Hi,
    I need a SQL Query to develop data set for the following columns:
    Revenue Code,Revenue Code Description,Invoice Amount,Revenue Amount,Original Invoice Number,Original Invoice Date.
    Can i get from ra_cust_trx_line_gl_dist_all and ra_customer_trx_all and ra_customer_trx_lines_all by joining them.But for the columns whcih to take
    i am in dilemma.
    Kindly any help will be needful for me

    Hi,
    I need a SQL Query to develop data set for the following columns:
    Revenue Code,Revenue Code Description,Invoice Amount,Revenue Amount,Original Invoice Number,Original Invoice Date.
    Can i get from ra_cust_trx_line_gl_dist_all and ra_customer_trx_all and ra_customer_trx_lines_all by joining them.But for the columns whcih to take
    i am in dilemma.
    Kindly any help will be needful for me

Maybe you are looking for