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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Do57792
Frequent Visitor

Datesinperiode / Display data over 12 month

Hello Experts,

 

I have the following problem. The duration of building the houses is always a year. I want to display a table ( and later graphs) like the sum of the needed workers over the year for every month.

Main Data:

HouseCompletionDatePlannedCompletionDatePlanned2Workers
101. Jan 202301.Feb 20245
201. Jul 202201.Sep 20237


Now I want to have a  table like this:

MonthJan 2023Feb 2023Mar 2023... 2023Jun 2024Jul 2023... 2023Dec 2023Jan 2024Feb 2024Mar 2024...Aug 2024Sep 2024...  
Workers CompletionDatePlanned1313131313555000000   
Workers CompletionDatePlanned 2000000777131313135   
Sum1313131313513137131313135   


I have only one column of completition for date 1 and date 2. I dont want to transpond the colums and rows, otherwise my rest of the visauls arent working anymore.
Now my problem is the following: I have a created calendar which respond to completion planned1. For this my formular is working fine and it display the workers for the 12 month of the year. The Month year correspond to this table. To get the same result for CompletionDatePlanned2 i have to use another connection between the tables and need to remove existing ones. How do I need to do this?

Could you please help me?

Existing Formular for Workers CompletionDatePlanned

calculate(sumx('Main Data','TMain Data'[Workers]),DATESINPERIOD(Calendar_Planned1[Date], max(Calendar_Planned1[Date]), -1,year) )
1 ACCEPTED SOLUTION
mickey64
Super User
Super User

For your reference.

 

Step 1: I add some relationships below.

mickey64_1-1723043869089.png

 

mickey64_0-1723043843531.png

 

Step 2: I make 3 measures.

M_Sum = calculate(sumx('Main Data','Main Data'[Workers]),DATESINPERIOD(Calendar[Date], max(Calendar[Date]), -1,year) )

 

M_Sum2 = calculate(sumx('Main Data','Main Data'[Workers]),USERELATIONSHIP('Main Data'[CompletionDatePlanned2],'Calendar'[Date]),DATESINPERIOD(Calendar[Date], max(Calendar[Date]), -1,year) )

 

M_Sum 1_2 = [M_Sum]+[M_Sum2]

 

Step 3: I make a table below.

mickey64_2-1723043911033.png

 

View solution in original post

4 REPLIES 4
Do57792
Frequent Visitor

One additional question: How can I get the cumulative number, which means:

Jan 2023Feb 2023Mar 2023... 2023Jun 2024Jul 2023... 2023
132639...7883....

 

I tried to use the the Calendar, but the connection between the tables is from date to date and the workers are for month. If I use a virtual table and add my workers as a seperate column to sum up this one, the result is wrong 😑

 

Do57792
Frequent Visitor

Many thanks!

mickey64
Super User
Super User

For your reference.

 

Step 1: I add some relationships below.

mickey64_1-1723043869089.png

 

mickey64_0-1723043843531.png

 

Step 2: I make 3 measures.

M_Sum = calculate(sumx('Main Data','Main Data'[Workers]),DATESINPERIOD(Calendar[Date], max(Calendar[Date]), -1,year) )

 

M_Sum2 = calculate(sumx('Main Data','Main Data'[Workers]),USERELATIONSHIP('Main Data'[CompletionDatePlanned2],'Calendar'[Date]),DATESINPERIOD(Calendar[Date], max(Calendar[Date]), -1,year) )

 

M_Sum 1_2 = [M_Sum]+[M_Sum2]

 

Step 3: I make a table below.

mickey64_2-1723043911033.png

 

rajendraongole1
Super User
Super User

Hi @Do57792 - can you try the below measure for workers CompletionDatePlanned and CompletionDatePlanned2:
Define measures to calculate the number of workers based on CompletionDatePlanned and CompletionDatePlanned2.

 

WorkersCompletionDatePlanned =
CALCULATE(
SUM('Main Data'[Workers]),
DATESINPERIOD(
'Calendar'[Date],
MAX('Calendar'[Date]),
-1,
YEAR
)
)

WorkersCompletionDatePlanned2 =
CALCULATE(
SUM('Main Data'[Workers]),
DATESINPERIOD(
'Calendar'[Date],
MAX('Calendar'[Date]),
-1,
YEAR
),
USERELATIONSHIP('Main Data'[CompletionDatePlanned2], 'Calendar'[Date])
)

 

Create a measure to sum the results of the two previous measures

TotalWorkers =
[WorkersCompletionDatePlanned] + [WorkersCompletionDatePlanned2]

 

Hope it helps





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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