Results 1 to 3 of 3

DAX measure like for like previous period totals

Threaded View

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

    DAX measure like for like previous period totals

    Hi,
    In a recent video like for like same period last year measures were created;

    so if current year only has 6 month the total for prevous year should aslo just have those months

    this was ;
    DATESBTWN :=
    VAR maxdate =
        EOMONTH ( MAX ( Table1[Date] ), -12 )
    VAR mindate =
        EDATE ( MIN ( 'Calendar'[Date] ), -12 )
    VAR period =
        DATESBETWEEN ( 'Calendar'[Date], mindate, maxdate )
    RETURN
        IF (
            NOT ( ISBLANK ( [TotalUnits] ) ),
            CALCULATE ( [TotalUnits], period ),
            BLANK ()
        )
    But I also tried the following which does give ( i think) the correct start and end dates but for the total I only get the last figure, I have highlighted this in the Pivot attached;
    StartToEnd :=
    VAR ddate =
        MAX ( Table1[Date] )
    VAR mindate =
        DATE ( YEAR ( ddate ) - 1, MONTH ( ddate ), 1 )
    VAR maxdate2 =
        EOMONTH ( ddate, -12 )
    VAR inbetween =
        DATESBETWEEN ( 'Calendar'[Date], mindate, maxdate2 )
    RETURN
        IF ( ISBLANK ( [TotalUnits] ), BLANK (), CALCULATE ( [TotalUnits], inbetween ) )
    Can someone see why I'm getting the wrong result, secondly is there a way apart form the 'IF' statement I've use to get ride of the unwanted figures
    I have highlighted these in orange, can someone tell me how they are calculated;

    Richard.

    Richard.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 09-22-2023, 11:57 AM
  2. Replies: 0
    Last Post: 02-02-2023, 05:13 AM
  3. Problem in Dax to create measure to find Previous date Latest Cost.
    By Ramzan-ul-Mubarak in forum Excel General
    Replies: 0
    Last Post: 03-17-2022, 03:56 AM
  4. Previous Rest Period Formula
    By dnicholas878 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-03-2019, 04:58 PM
  5. [SOLVED] Movement of figure from previous period
    By rooboyz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-17-2013, 11:14 AM
  6. [SOLVED] How to get cumulative totals from weekly totals (IE sum of all previous cells)?
    By moeburn in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-08-2013, 07:29 PM
  7. Cumulative/This period Totals
    By jswarb001 in forum Excel General
    Replies: 4
    Last Post: 09-17-2009, 04:04 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