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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
AllanBerces
Post Prodigy
Post Prodigy

Calculated Column to Measure

Hi can anyone help me to change to measure my calculated column in TRS Table, column (Overall_Cum_PT_YTD) 

 

Overall_Cum_PT_YTD = VAR CurrentDate = 'TRS'[WeekNo:]
VAR Filteredtable = FILTER('TRS','TRS'[WeekNo:]<=CurrentDate )

return

CALCULATE(SUM('TRS'[NPTHrs]), TRS[Type] <> "Non-productive", Filteredtable)

 

https://drive.google.com/file/d/1i1JojzfjyY7Mp4304xyBoNOKvuQJ595F/view?usp=sharing

 

Thank you

1 ACCEPTED SOLUTION

Hello @AllanBerces 

To make the formula work when the [used_Area] column is in context, you can use the following DAX instead:

 

Overall_Cum_PT_YTD_Measure = 
VAR CurrentDate =
    SELECTEDVALUE ( TRS[WeekNo:] )
VAR Filteredtable =
    FILTER (
        ALL ( 'TRS' ),
        TRS[WeekNo:] <= CurrentDate
            && TRS[Type] <> "Non-productive"
    )
RETURN
    IF (
        ISINSCOPE ( TRS[used_AREA] ),
        CALCULATE (
            SUM ( 'TRS'[NPTHrs] ),
            Filteredtable,
            VALUES ( TRS[used_AREA] )
        ),
        CALCULATE (
            SUM ( 'TRS'[NPTHrs] ),
            Filteredtable
        )
    )

 

I am attaching the Power BI with modified formula in the attachment.

 

Best Regards,
Udit


If this post helps, then please consider Accepting it as the solution to help other members find it more quickly.
Appreciate your Kudo 👍

🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
Visit My Linktree: LinkTree

Proud to be a Super User

View solution in original post

7 REPLIES 7
quantumudit
Super User
Super User

Hello @AllanBerces 
Please use the following DAX to create the measure with the same logic that you have used for creating the calculated column.

 

Overall_Cum_PT_YTD_Measure = 
VAR CurrentDate = SELECTEDVALUE(TRS[WeekNo:])
VAR Filteredtable = FILTER(
    ALL('TRS'),
    TRS[WeekNo:] <= CurrentDate 
    && TRS[Type]  <> "Non-productive"
)

RETURN
CALCULATE(
    SUM('TRS'[NPTHrs]), 
    Filteredtable
)

 

Additionally, there is a BSPTA calculated column in your TRS that is erroneous. Make sure to fix it or delete it, as it might create issues testing other aspects.

 

I am also attaching the Power BI file for your reference.

 

Best Regards,
Udit

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍

🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
Visit My Linktree: LinkTree

 

Proud to be a Super User

Hi @quantumudit my mistake ignore the first DIRED OUTPUT, my DESIRED OUTPUT

AllanBerces_2-1739625089683.png

Thank you

Hi @quantumudit 

Desired Output

AllanBerces_1-1739624510835.png

 

Hi @quantumudit thank yu very much for the reply, but when i put table show same value for used_AREA, possible to segregate by used_AREA

AllanBerces_0-1739624196554.png

Thank you

Hello @AllanBerces 

To make the formula work when the [used_Area] column is in context, you can use the following DAX instead:

 

Overall_Cum_PT_YTD_Measure = 
VAR CurrentDate =
    SELECTEDVALUE ( TRS[WeekNo:] )
VAR Filteredtable =
    FILTER (
        ALL ( 'TRS' ),
        TRS[WeekNo:] <= CurrentDate
            && TRS[Type] <> "Non-productive"
    )
RETURN
    IF (
        ISINSCOPE ( TRS[used_AREA] ),
        CALCULATE (
            SUM ( 'TRS'[NPTHrs] ),
            Filteredtable,
            VALUES ( TRS[used_AREA] )
        ),
        CALCULATE (
            SUM ( 'TRS'[NPTHrs] ),
            Filteredtable
        )
    )

 

I am attaching the Power BI with modified formula in the attachment.

 

Best Regards,
Udit


If this post helps, then please consider Accepting it as the solution to help other members find it more quickly.
Appreciate your Kudo 👍

🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
Visit My Linktree: LinkTree

Proud to be a Super User

Hi @quantumudit thank you very much working perfectly

@AllanBerces 

Appreciate your Kudo 👍


Proud to be a Super User

Sticker-Challenge-show-sparkle.png

 

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.