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
Anonymous
Not applicable

Dax - Related - Help

Hi,

 

I have a holiday table which has

 

Date                           Number

01/01/2016                1

02/01/2016                2

 

 etc and in my fact table I have 

 

TDD Date

 

Basically I am wanting a column/measure in my fact table that gets the number for todays date and minus the TDD Number.

 

Any help to go about this appreciated.

 

Thanks

 

 

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

Did you mean this?

 

Measure:

Minus Value =
VAR TDDNum =
    CALCULATE (
        MAX ( Holiday[ID] ),
        FILTER ( Holiday, Holiday[Date] = MAX ( 'Fact'[TDD Date] ) )
    )
VAR TodayNum =
    CALCULATE ( MAX ( Holiday[ID] ), Holiday[Date] = TODAY () )
RETURN
    TDDNum - TodayNum

2.PNG

 

Thanks,
Xi Jin.

View solution in original post

3 REPLIES 3
v-xjiin-msft
Solution Sage
Solution Sage

Hi @Anonymous,

 

First what are today's number and the TDD number? What's the relationship between holiday table and fact table? And what's the logic to make today's number minus the TDD number?

 

Please share us more information about your requirement like your table structure and some sample data with its expected result.

 

Thanks,
Xi Jin.

Anonymous
Not applicable

Holiday Table

 

Date                  ID

01/01/2001        2

02/01/2001        3

19/04/2018        500

 

Fact Table

 

TDD Date

01/01/2001

 

I am joining the two tables on date and I am wanting to get the related ID for tdd date and minus that from todays date ID

 

 

Thanks

Hi @Anonymous,

 

Did you mean this?

 

Measure:

Minus Value =
VAR TDDNum =
    CALCULATE (
        MAX ( Holiday[ID] ),
        FILTER ( Holiday, Holiday[Date] = MAX ( 'Fact'[TDD Date] ) )
    )
VAR TodayNum =
    CALCULATE ( MAX ( Holiday[ID] ), Holiday[Date] = TODAY () )
RETURN
    TDDNum - TodayNum

2.PNG

 

Thanks,
Xi Jin.

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.