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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
kavimk
Frequent Visitor

multiple date in fact table, need to create the measure with both date

Hi All,

Order Fact:

Order Create date

Financial close date
Date Hierarchy:
Date

 

Active relationship: Date Hierarchy[Date] = Order Fact[order create date)

Inactive relationship: Date Hierarchy[Date] = Order Fact[fiancial close date)

I want to create the Measure with filter 
Calculate ( sum( order amount)),Filter(order fact,
order date < 2023-11-01 && financial close date>=2023-11-01))
I want to work this measure dynamically by user selection of month from date hierarchy

 

Thanks for your support

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @kavimk 

The measure I offerd change dynamically, you can choose the month, it will return all the date that meet the condition(include the past period),you can download the pbix I have offered at the 5th message.

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @kavimk 

As @amitchandak  mentioned, you can use crossfilter() function

You can refer to the following sample.

Sample data 

vxinruzhumsft_0-1707186013857.png

Date table

vxinruzhumsft_1-1707186026612.png

You can create a measure.

Measure =
IF (
    ISFILTERED ( 'Date'[Date].[Month] ),
    CALCULATE (
        SUM ( 'Order Fact'[order amount] ),
        EOMONTH ( 'Order Fact'[Order Create date], 0 )
            <= EOMONTH ( MAX ( 'Date'[Date] ), 0 )
            && EOMONTH ( 'Order Fact'[Financial close date], 0 )
                >= EOMONTH ( MAX ( 'Date'[Date] ), 0 ),
        CROSSFILTER ( 'Date'[Date], 'Order Fact'[Order Create date], NONE )
    ),
    CALCULATE ( SUM ( 'Order Fact'[order amount] ) )
)

Output

vxinruzhumsft_2-1707186140979.png

 

vxinruzhumsft_3-1707186226045.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Thanks for your support
order Create < 2023-11-01 which means it will give all period 2022,2021,2020 when finacial close date >=2023-11-01

EOMONTH work on specific month not enitre month

Anonymous
Not applicable

Hi @kavimk 

You can try the following measure

 

Measure =
VAR a =
    EOMONTH ( MAX ( 'Date'[Date] ), -1 ) + 1
//it will return the first day of the month you have chosen
RETURN
    IF (
        ISFILTERED ( 'Date'[Date].[Month] ),
        CALCULATE (
            SUM ( 'Order Fact'[order amount] ),
            'Order Fact'[Order Create date] <= a
                && 'Order Fact'[Financial close date] >= a,
            CROSSFILTER ( 'Date'[Date], 'Order Fact'[Order Create date], NONE )
        ),
        CALCULATE ( SUM ( 'Order Fact'[order amount] ) )
    )

 

 

 

vxinruzhumsft_0-1707268482178.png

 

And EOMONTH() means it will return the last day of the month, not the specific month, it wll also return the entire month, EOMONTH(date[date],0) means it will return all the last dates of the months of each date, You can see the following picture.

vxinruzhumsft_1-1707268747572.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thanks for response Expected result is,

kavimk_0-1707278053903.png

 

Measure=

CALCULATE(SUM('Orders Fact'[Amt]),
FILTER('Date Hierarchy','Date Hierarchy'[Year Month]<"2024-JAN")
,FILTER('Date Hierarchy Fin_cls','Date Hierarchy Fin_cls'[Year Month]=2024-JAN))

This measure should work dynamically, if you notice order create value we have data periods in past
Anonymous
Not applicable

Hi @kavimk 

The measure I offerd change dynamically, you can choose the month, it will return all the date that meet the condition(include the past period),you can download the pbix I have offered at the 5th message.

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

amitchandak
Super User
Super User

@kavimk , Have tried using userelationship to create the measure

 

Calculate ( sum( order amount)), userelationship('Date Hierarchy'[Date] , 'Order Fact'[fiancial close date]))

example

HR Analytics- Hired, terminated, and active employees using UserRelationships and crossfilter: https://youtu.be/K14OPlGc9E8

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.