+ Reply to Thread
Results 1 to 4 of 4

DAX power pivot Variable versus Earlier

  1. #1
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    594

    DAX power pivot Variable versus Earlier

    Hi,

    I have a working formula ;

    Please Login or Register  to view this content.
    But thought I would try to replicate it using a variable so;

    Please Login or Register  to view this content.

    But can't seem to get this to work, I hope I'm missing something really obvious , work book attached show p table with results;

    Richard.
    Attached Files Attached Files

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: DAX power pivot Variable versus Earlier

    Hi,

    You just have to be careful where you place your VAR statement.

    PHP Code: 
    With VAR :=
    SUMX(
        
    Table1,
        VAR 
    aregion Table1[Regeion]
        RETURN
            
    1
                
    COUNTROWS(
                    
    FILTER(
                        
    ALLTable1 ),
                        
    Table1[Regeion] = aregion
                    
    )
                )
                * 
    RELATEDTable2[Budget] )

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    594

    Re: DAX power pivot Variable versus Earlier

    Thank,
    this is actually something I don't really get, VARIABLES and where to put them, I have a similar problem in power query,
    a lot of information on using a variable as a 'query' but not much on using them within a query step, it's like in a lot of sqlbi
    videos you'll get more than one return.


    Richard

  4. #4
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    594

    Re: DAX power pivot Variable versus Earlier

    Just to add if you know of any blogs etc. with information on this I'd be grateful, I do have the Russo and Ferrari book, but am not jumping ahead, so don't know if they cover it.

    Richard.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. DAX ALLEXCEPT versus ALL & VALUES in Power Pivot
    By Dicken in forum Office 365
    Replies: 4
    Last Post: 08-04-2022, 09:17 AM
  2. Replies: 3
    Last Post: 08-10-2020, 11:38 AM
  3. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  4. [SOLVED] Refreshing earlier stated variable?
    By Imbizile in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2017, 10:43 AM
  5. [SOLVED] Variable Column Headers in or attached to a Power Pivot Table
    By RAdams1 in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 10-25-2017, 11:29 AM
  6. Obect Required error when variable already set earlier in sub?
    By mrbusto71 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2016, 09:00 PM
  7. Object usage versus using a numerical variable in .find function
    By adamstarr12 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-16-2014, 02:10 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1