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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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