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
giorgilomidze
Resolver I
Resolver I

groupby days calculated column

i have task on which people are working. tasknumbers are uniq. per day there can be several tasks person can work on. lets take that person worked on 3 taks and sum of hours he worked is 6 hours. It means that person was 18 hours free ( 24-6 they have 24 H shifts).  i have task starting time and task ending time. with help of datediff i have hours he has worked. 

i need to get sum of hours he was free each day in matrix. rows-name; columns -date. when i subtract 24-[time he has worked], if he has worked more than 1 task,lets take 3 tasks, it menas that he will have 72 working hours -6 houres worked , thus 66 hours free and 6 hours worked.

1 ACCEPTED SOLUTION

Hi @giorgilomidze,

 

You can try to use below measure if it suitable for your requirement:

Free Hours = 
VAR _current =
    DATEVALUE ( MAX ( [VALIDFROM] ) )
VAR total =
    SUMX (
        FILTER (
            ADDCOLUMNS (
                Sheet1,
                "Daily Diff", DATEDIFF ( [VALIDFROM], DATEVALUE ( [VALIDFROM] ) + 1, HOUR )
            ),
            [NAME] = SELECTEDVALUE ( Sheet1[NAME] )
                && DATEVALUE ( [VALIDFROM] ) = _current
        ),
        [Daily Diff]
    )
RETURN
    IF ( total > 6, total - 6 )

10.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

5 REPLIES 5
v-shex-msft
Community Support
Community Support

HI @giorgilomidze,

 

It will be help if you share some sample data/pbix file and expected result for analysis.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Untitled.pngthere is shown one persons working hours. task time is difference between validfrom and validto. valid from is when task has started and valid to is when task was finished.

i whant to see what amount of time one person has per day in matrix visual. ( there can be days when person can have negative free time, becouse he was assigned to more than one task at the same time)

HI @giorgilomidze,

 

Can you share us sample data share with excel or pbix file. It is hard to import data from your screenshots.


Regbards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Google Drive Execel File. I dont know how to upload. Here is Google Drive link for Excel. 

Hi @giorgilomidze,

 

You can try to use below measure if it suitable for your requirement:

Free Hours = 
VAR _current =
    DATEVALUE ( MAX ( [VALIDFROM] ) )
VAR total =
    SUMX (
        FILTER (
            ADDCOLUMNS (
                Sheet1,
                "Daily Diff", DATEDIFF ( [VALIDFROM], DATEVALUE ( [VALIDFROM] ) + 1, HOUR )
            ),
            [NAME] = SELECTEDVALUE ( Sheet1[NAME] )
                && DATEVALUE ( [VALIDFROM] ) = _current
        ),
        [Daily Diff]
    )
RETURN
    IF ( total > 6, total - 6 )

10.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.