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
lc1
Helper III
Helper III

Sum numeric values using filters

Hello,

I have two columns PAR_Hours which are numeric values and PAR_Codes which are text values. I need to sum all hours for specific codes (LN, LD and DR)

I tried using several versions of this formula to no avail, results are always blank.

 

CALCULATETABLE(VALUES(Absenteeism[PAR_HOURS]),filter(Absenteeism,Absenteeism[PAR_CODE]="LN"&"LD"&"DR"))
 
CALCULATE(SUM(Absenteeism[PAR_HOURS]),Absenteeism[PAR_CODE]="LN",Absenteeism[PAR_CODE]="LD",Absenteeism[PAR_CODE]="DR")
 
 
 
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

=CALCULATE(SUM(Absenteeism[PAR_HOURS]),Absenteeism[PAR_CODE]="LN"||Absenteeism[PAR_CODE]="LD"||Absenteeism[PAR_CODE]="DR")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

=CALCULATE(SUM(Absenteeism[PAR_HOURS]),Absenteeism[PAR_CODE]="LN"||Absenteeism[PAR_CODE]="LD"||Absenteeism[PAR_CODE]="DR")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you, it worked!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-lionel-msft
Community Support
Community Support

Hi @lc1 ,

 

Try this measure:

 

Measure=
CALCULATE(
    SUM(Absenteeism[PAR_HOURS]),
    FILTER(
        Absenteeism,
        Absenteeism[PAR_CODE] in {"LN", "LD", "DR"}
    )
)

OR

Measure1=
CALCULATE(
    SUM(Absenteeism[PAR_HOURS]),
    FILTER(
       ALL(Absenteeism),
        Absenteeism[PAR_CODE] in {"LN", "LD", "DR"}
    )
)

 

"MdxScript (Model 8, 37)...A table of multiple values was supplied where a single value was expected."

VALUES(Absenteeism[PAR_HOURS]) will return a single column table, however, you what you created is a measure, so the program reports an error.

VALUES() function 

 

Best regards,
Lionel Chen

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

 

amitchandak
Super User
Super User

Try

CALCULATETABLE(VALUES(Absenteeism[PAR_HOURS]),filter(Absenteeism,Absenteeism[PAR_CODE] in {"LN","LD","DR"}))
OR
CALCULATETABLE(VALUES(Absenteeism[PAR_HOURS]),filter(all(Absenteeism),Absenteeism[PAR_CODE] in {"LN","LD","DR"}))
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

It didn't work, got an error:

MdxScript (Model 8, 37)...A table of multiple values was supplied where a single value was expected.

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.