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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AllanBerces
Post Prodigy
Post Prodigy

Sum base from two column

Hi good day,

Can anyone help me to correct my measure. I want to calculate the sum of NPT base from two column trade and specific type.

 

CALCULATE(
SUM('Table'[NPTHrs]), Table[Type] =  "Non-productive"

AllanBerces_0-1739436091660.png

Thank you

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AllanBerces 

 

Thanks for the reply from wini_R .

 

Due to some security policy, I can't open your link. From your formula, my suggestion is that you can try to remove ALL.

vxuxinyimsft_0-1739503045358.png

 

For more details about ALL function,  you can read related document link:

ALL function (DAX) - DAX | Microsoft Learn

 

If you need further help, could you please consider showing your PBIX in the following form?

vxuxinyimsft_1-1739503131614.png

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

 

Best Regards,
Yulia Xu

 

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

4 REPLIES 4
wini_R
Solution Supplier
Solution Supplier

Hey @AllanBerces,

Can you please provide data sample in text format, as well as your current and expected results?

Hi @wini_R thank you for the reply, Basically i want to segregate it by Area but when i put it on table show this, it just duplicate the data. 

AllanBerces_0-1739493597975.png

My Measure: 01

LastWeek_Yrly_PT =
VAR CurrentWeek = MAX('TRS'[WeekNo:])
RETURN
IF(TRS[Total WKly Hrs] > WEEKNUM(TODAY()),
CALCULATE(
SUM('TRS'[NPTHrs]), TRS[Type] =  "Direct",
FILTER(
ALL('TRS'),
'TRS'[WeekNo:] <= CurrentWeek  &&
'TRS'[Year] = MAX('TRS'[Year])
)
))
 
Measure: 02
LastWeek_Yrly_NPT =
VAR CurrentWeek = MAX('TRS'[WeekNo:])
RETURN
IF(TRS[Total WKly Hrs] > WEEKNUM(TODAY()),
CALCULATE(
SUM('TRS'[NPTHrs]), TRS[Type] =  "Non-productive",
FILTER(
ALL('TRS'),
'TRS'[WeekNo:] <= CurrentWeek  &&
'TRS'[Year] = MAX('TRS'[Year])
)
))
Measure 03:
LastWK_Overall_Yearly_PT = [LastWeek_Yrly_PT]/(([LastWeek_Yrly_PT]+[LastWeek_Yrly_NPT])/12)
Measure 04:
Total WKly Hrs =
VAR CurrentDate = TODAY()
VAR CurrentWeekNumber = WEEKNUM(CurrentDate, 2)
VAR LastWeekNo = CurrentWeekNumber -1
RETURN
CALCULATE(
SUM('TRS'[NPTHrs]),
FILTER(
ALL('Dimdate Calendar'),
'Dimdate Calendar'[Week No.] <= LastWeekNo
&& 'Dimdate Calendar'[Year] = YEAR(CurrentDate)
&& 'Dimdate Calendar'[Week No.] >= 1
)
 
Thank you
Anonymous
Not applicable

Hi @AllanBerces 

 

Thanks for the reply from wini_R .

 

Due to some security policy, I can't open your link. From your formula, my suggestion is that you can try to remove ALL.

vxuxinyimsft_0-1739503045358.png

 

For more details about ALL function,  you can read related document link:

ALL function (DAX) - DAX | Microsoft Learn

 

If you need further help, could you please consider showing your PBIX in the following form?

vxuxinyimsft_1-1739503131614.png

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

 

Best Regards,
Yulia Xu

 

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

Hi @Anonymous thank you very much for the reply working perfectly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.