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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.