+ Reply to Thread
Results 1 to 6 of 6

Writing text near pivot table with dax

  1. #1
    Forum Contributor
    Join Date
    03-24-2014
    Location
    Lisboa, Portugal
    MS-Off Ver
    Office 365
    Posts
    177

    Writing text near pivot table with dax

    Hi guys

    Usualy my reports have always the information of the dates of the report, i mean, between this date and that date.
    In excel is pretty easy to do it, but i can't do the same with with dax on my power pivot.
    Is there any way of doing it, for example something like this :

    ="This report is from "&MAX(Purchases[Date])&" till"&MIN(Purchases[Date])

    Thank you so much guys
    Pedro

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: Writing text near pivot table with dax

    Hmm, there really isn't enough detail to give you specifics.

    But in general you'd do this in separate pivot table from your data.

    Assuming that you want to show first & last date, regardless of filter applied...
    lastdate:=MAXX(ALL(Purchases),[Date])
    firstdate:=MINX(ALL(Purchases),[Date])
    DateRange:="This report is from " & [firstdate] & " till " & [lastdate]

    Stick "DateRange" measure into value field.
    0.JPG

    If it should change with filter (i.e. slicer set up with link), just use MAX() and MIN() respectively.
    Last edited by CK76; 08-14-2018 at 09:04 AM.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    03-24-2014
    Location
    Lisboa, Portugal
    MS-Off Ver
    Office 365
    Posts
    177

    Re: Writing text near pivot table with dax

    Hello CK
    Did the same as you, but without the DateRange built, cose i have several tables, but it's a big satisfaction that i came up the same solution. I wish i could, of course after build those measures for each table, do it without have to do a pivot table...or as much as i need.
    Just a quik question: what i did is a measure that concatenates the min and the max, for each table, but without the X and the ALL, cose those tables are never filtered. Cose i'm just a beginner in dax, why did you do it with X and ALL?

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: Writing text near pivot table with dax

    MAX/MIN is aggregator function and summarizes ALL rows in current filter context.

    Where as MAXX/MINX is iterator function and evaluates by iterating over each row in current filter context.

    Syntax for MAXX/MINX is Function(Table, Expression).

    This allows the function to override filter context of slicers etc.
    Hence, I added ALL(Table) to ignore all fiter and evaluate MAXX on entire table.
    Resulting in same value returned regardless of slicer selection.

    Where as MAX/MIN will change as filter context changes.

    If you don't apply filter, then both function will return same result, and MAX/MIN is more efficient as it does not need to iterate over each row.

  5. #5
    Forum Contributor
    Join Date
    03-24-2014
    Location
    Lisboa, Portugal
    MS-Off Ver
    Office 365
    Posts
    177

    Re: Writing text near pivot table with dax

    Awesome. Thank you so much

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: Writing text near pivot table with dax

    You are welcome and thanks for the rep

+ 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. Replies: 1
    Last Post: 09-06-2016, 04:59 AM
  2. [SOLVED] Transpose text only data into table (like pivot table but with text only)
    By FelicityHall in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-20-2015, 04:54 PM
  3. Writing Code for creating pivot table
    By kw42chan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2011, 11:40 AM
  4. PIvot Table: Help writing a calculated field
    By shannonvhm in forum Excel General
    Replies: 0
    Last Post: 10-22-2009, 11:38 AM
  5. [SOLVED] Match row that contains text text string; list associated values from pivot table
    By ACurtis802 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-29-2009, 07:50 PM
  6. Replies: 1
    Last Post: 04-15-2008, 01:59 AM
  7. retain table formatting when writing excel table to a txt file
    By deanop in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-03-2005, 01:05 AM

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