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
Kaveh
New Member

Calendar

 I have 7 tables , each tables has various rows and columns. One column is Dates ( in each table ).

I want to create a calendar using DAX that picks up the MAX from these tables columns. 

The min value is picked up from another table. 

any suggestion ?

1 ACCEPTED SOLUTION
v-yetao1-msft
Community Support
Community Support

Hi @Kaveh 

Please correct me if I wrongly understood your issue .

You need to return the Max date from these multiple tables and then return the MIX date from these multiple tables .Then use the two dates to create a new Calendar date table .

Create a table with the following formula .

Calendar Date =
var _MIN=MINX({MIN('Table 1'[Date 1]),MIN('Table 2'[Date 2]),MIN('Table 3'[Date 3]),MIN('Table 4'[Date 4])},[Value])
var _MAX=MAXX({MAX('Table 1'[Date 1]),MAX('Table 2'[Date 2]),MAX('Table 3'[Date 3]),MAX('Table 4'[Date 4])},[Value])
return CALENDAR(_MIN,_MAX)

And the final result is as shown(Max date is 2021-04-05 and Min date is 2021-01-01) :

Ailsamsft_0-1632465493755.png

Ailsamsft_1-1632465528273.gif

[value] is used to return some values in the previous {}, Take the above formula as an example: {MIN('Table 1'[Date 1]),MIN('Table 2'[Date 2]),MIN('Table 3'[Date 3]),MIN('Table 4'[Date 4])},[Value] , here [value] is used to return the min date in the four tables, and the final result is 2021-01-01,2021-02-01,2021-03-01,2021-04-01 . Is this explanation clear ?

I have attached my pbix file ,you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

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

3 REPLIES 3
v-yetao1-msft
Community Support
Community Support

Hi @Kaveh 

Please correct me if I wrongly understood your issue .

You need to return the Max date from these multiple tables and then return the MIX date from these multiple tables .Then use the two dates to create a new Calendar date table .

Create a table with the following formula .

Calendar Date =
var _MIN=MINX({MIN('Table 1'[Date 1]),MIN('Table 2'[Date 2]),MIN('Table 3'[Date 3]),MIN('Table 4'[Date 4])},[Value])
var _MAX=MAXX({MAX('Table 1'[Date 1]),MAX('Table 2'[Date 2]),MAX('Table 3'[Date 3]),MAX('Table 4'[Date 4])},[Value])
return CALENDAR(_MIN,_MAX)

And the final result is as shown(Max date is 2021-04-05 and Min date is 2021-01-01) :

Ailsamsft_0-1632465493755.png

Ailsamsft_1-1632465528273.gif

[value] is used to return some values in the previous {}, Take the above formula as an example: {MIN('Table 1'[Date 1]),MIN('Table 2'[Date 2]),MIN('Table 3'[Date 3]),MIN('Table 4'[Date 4])},[Value] , here [value] is used to return the min date in the four tables, and the final result is 2021-01-01,2021-02-01,2021-03-01,2021-04-01 . Is this explanation clear ?

I have attached my pbix file ,you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

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

Kaveh
New Member

what does [value] refer to ?

 

mahoneypat
Employee
Employee

You can try an expression like this to do that.

 

Calendar =
VAR vMinDate =
    MIN ( Table1[Date1] )
VAR vMaxDate =
    MAXX (
        MAX ( Table2[Date2] )MAX ( Table3[Date3] )MAX ( Table4[Date4] ) },
        //add more as needed
        [Value]
    )
RETURN
    CALENDAR ( vMinDatevMaxDate )

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.