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

How to rewrite values in columns using DAX

Hi community!

 

I'm new to power bi and would appreciate your help. 

I have a report with names, tasks, dates and hours spent on tasks.

The problem is to identify the task ABCD in each name and if there are such tasks I have to sum up the hours. Then I have to count all the other rows within each name and split the hours the name spent on ABCD task into the count of rows except ABCD. Then I have to increment each row within the name and date except where ABCD is into this number and rows with ABCD must remain empty or equal zero. In short I have to add hours spent by a name  within each month equally to other tasks. I tried creating different measures with the help of GPT but never reached my goal:

SUM of ABCD:

ABCD Sum = CALCULATE(
    [Total hours],
        FILTER(
            Table,
            Table[Employee] = [Employee]
                && (Table[Task] = "ABCD")
        )
    )

Row count:

Rowcount = 

    SUMMARIZE(
        FILTER(
            Table,
            Table[Employee] = [Employee] &&
            Table[Task] <> "ABCD"
        ),
        "Rowcount",
        COUNTX(Table, Table[Task]
    ))

Splitting hours:

Hrs split = 

DIVIDE([ABCD Sum], [Rowcount])

Adding to other rows except where ABCD is:

Added = 
SUMX(
    Filter(
        Table,
        Table[Employee] = [Employee] &&
        Table[Task] <> "ABCD"
        ),
    [Hrs split]
)

and it stopped working here - shows no data at all:(

The table itself is here 

 

Would appreciate your advice on how to solve my problem

4 REPLIES 4
Anonymous
Not applicable

Hi @kate1212klim ,

 

You could create 2 what-if parameters for the 2 values of monthly changing.

vstephenmsft_4-1683773628237.png

 

 

vstephenmsft_5-1683774351520.png

Then I get the slicer, which I chose in the "vertical list" format for both.

vstephenmsft_6-1683774405541.png

Create the [hrs to add] measure and the [RESULT] measure.

hrs to add = IF(MAX('Table'[Task])="ABCD",0,IF(MAX('Table'[Employee])="JLO",[JLO&ABCD Value],IF(MAX('Table'[Employee])="LGAGA",[LGAGA&ABCD Value])))
RESULT = 
 var _res=[hrs to add]+COUNT('Table'[Hours])
 return 
 IF(MAX('Table'[Task])="ABCD",0,IF(MAX('Table'[Employee])="JLO",_res,IF(MAX('Table'[Employee])="LGAGA",_res
)))

vstephenmsft_7-1683774709332.png

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

Thank you Stephen! I'll try this out❤️

Mahesh0016
Super User
Super User

@kate1212klim Please Share Your expected Output In Table.

Yes, thank you!

2023-05-05_15-59.png

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.