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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Wicak
Helper I
Helper I

DAX Calculate by 2 category by date

Table Product

Wicak_0-1645759755783.png

table time

Wicak_1-1645759781035.png

I have two table related to date. i want to sum per Product Category with Product category time. i want measure speed ( good product/time) per category, i have example 

Wicak_3-1645760451077.png

then i try in PBI with new measure. i  have a problem when i create new measure, model like this 

Speed =

CALCULATE(

              SUM('Table Product'[SKU]'),

              ('Table Product'[SKU] IN { "SKU A" })

/ SUM('Time'[SKU A])

 

this model not error. but when i visualized, this measure error. this pop up   

Wicak_2-1645760344784.png

please your advice, thanks 

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @Wicak 

 

Try this measure:

 

SPEED = 
VAR _A =
    SUM ( 'Time'[SKU A] )
VAR _B =
    SUM ( 'Time'[SKU B] )
VAR _C =
    SUM ( 'Time'[SKU C] )
VAR _SGP =
    SUM ( 'Table Product'[Good Product] )
VAR _SKU =
    MAX ( 'Table Product'[SKU] )
VAR _SWSK =
    SWITCH ( _SKU, "SKU A", _A, "SKU B", _B, "SKU C", _C )
RETURN
    _SGP / _SWSK

 

 

output:

VahidDM_0-1645765816061.png

 

Download the file: https://gofile.io/d/e2BlMk

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

2 REPLIES 2
Wicak
Helper I
Helper I

Thanks @VahidDM 😁

VahidDM
Super User
Super User

Hi @Wicak 

 

Try this measure:

 

SPEED = 
VAR _A =
    SUM ( 'Time'[SKU A] )
VAR _B =
    SUM ( 'Time'[SKU B] )
VAR _C =
    SUM ( 'Time'[SKU C] )
VAR _SGP =
    SUM ( 'Table Product'[Good Product] )
VAR _SKU =
    MAX ( 'Table Product'[SKU] )
VAR _SWSK =
    SWITCH ( _SKU, "SKU A", _A, "SKU B", _B, "SKU C", _C )
RETURN
    _SGP / _SWSK

 

 

output:

VahidDM_0-1645765816061.png

 

Download the file: https://gofile.io/d/e2BlMk

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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