Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Kandidel
Frequent Visitor

Ignore date from slicer for calculating a measure

Hi all,

 

need help with a DAX formula, please.

 

I would like to show sum of sales for selected period plus order book data with delivery year = selected delievery year.

I have no issue with the sum of sales, but with the orderbook data.
For example, when user selects this year (2022), everything is fine.
But when user would like to see, what is already in the order book with delivery year in 2023 for example, I don't get expected result but only zero. Seems, I do not have the filters correct. Could you please help me correct? Thanks in advance.

My formula for order book currently is this:

OB Current Year =
var _lastdate = Calculate(MAX('Orderbook ACT'[Date]), All('Orderbook ACT'))  // find latest order book data
return
CALCULATE(SUM('Orderbook ACT'[Ext Sales]),'Orderbook ACT'[EX/IG] ="EX", filter('Orderbook ACT', 'Orderbook ACT'[Date]=_lastdate),'Orderbook ACT'[Revenue Rec Year] = SELECTEDVALUE('Calendar'[Year]))
1 ACCEPTED SOLUTION
SpartaBI
Community Champion
Community Champion

@Kandidel 

OB =
VAR _lastdate =
    CALCULATE ( MAX ( 'Orderbook ACT'[Date] ), ALL ( 'Orderbook ACT' ) )
VAR _recognition_year = SELECTEDVALUE ( 'Calendar'[Year] )
RETURN
    CALCULATE (
        SUM ( 'Orderbook ACT'[Ext Sales] ),
        'Orderbook ACT'[EX/IG] = "EX",
        'Orderbook ACT'[Date] = _lastdate,
        'Orderbook ACT'[Revenue Rec Year] = _recognition_year,
        REMOVEFILTERS('Calendar')
    )

View solution in original post

5 REPLIES 5
SpartaBI
Community Champion
Community Champion

@Kandidel 

OB =
VAR _lastdate =
    CALCULATE ( MAX ( 'Orderbook ACT'[Date] ), ALL ( 'Orderbook ACT' ) )
VAR _recognition_year = SELECTEDVALUE ( 'Calendar'[Year] )
RETURN
    CALCULATE (
        SUM ( 'Orderbook ACT'[Ext Sales] ),
        'Orderbook ACT'[EX/IG] = "EX",
        'Orderbook ACT'[Date] = _lastdate,
        'Orderbook ACT'[Revenue Rec Year] = _recognition_year,
        REMOVEFILTERS('Calendar')
    )
SpartaBI
Community Champion
Community Champion

@Kandidel try:

 

OB Current Year =
var _lastdate = Calculate(MAX('Orderbook ACT'[Date]), All('Orderbook ACT'))  // find latest order book data
return
CALCULATE(SUM('Orderbook ACT'[Ext Sales]),'Orderbook ACT'[EX/IG] ="EX", 
'Orderbook ACT'[Date]=_lastdate,'Orderbook ACT'[Revenue Rec Year] = SELECTEDVALUE('Calendar'[Year]))

 


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

Thanks @SpartaBI , this did not change anything unfortunately.

 

@Kandidel you can PM me with a link to zoom / teams and we can look together

@Kandidel 
Write this:

OB =
VAR _lastdate =
    CALCULATE ( MAX ( 'Orderbook ACT'[Date] ), ALL ( 'Orderbook ACT' ) )
RETURN
    CALCULATE (
        SUM ( 'Orderbook ACT'[Ext Sales] ),
        'Orderbook ACT'[EX/IG] = "EX",
        'Orderbook ACT'[Date] = _lastdate,
        'Orderbook ACT'[Revenue Rec Year] = SELECTEDVALUE ( 'Calendar'[Year] )
    )

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.