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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
dwhittaker1
Helper II
Helper II

Help understanding Measure

Can anyone help me understand the below measure. My interpretation is
if Price per unit -PY$ is blank then sum where Price per unit - PY$ is greater than 0. I dont uderstand the rest.
 
Price Impact - Sales - CY vs PY $ =
IF(
    [Price per Unit - PY $]=BLANK(),
        BLANK(),
        SUMX(
            FILTER(
                ALL(  FactSalesInvoiceLine[InvoiceItemID],FactSalesInvoiceLine[InvoiceMonth] ),
                [Price per Unit - PY $] > 0
                ),
            CALCULATE([Unit Quantity - CY]*[Price per Unit - CY vs PY $])
        )
)
1 ACCEPTED SOLUTION
audreygerred
Super User
Super User

This DAX expression is used to calculate a value based on certain conditions. Here's how it works:

  1. It first checks if the column [Price per Unit - PY $] is blank. If it is, the result is also set to blank, and the calculation stops. This condition handles cases where the price for the previous year is missing or not available.

  2. If the [Price per Unit - PY $] is not blank, it proceeds to the next step. It filters the data in the table FactSalesInvoiceLine based on the following conditions:

    • It considers all rows but filters them down to those where [Price per Unit - PY $] is greater than 0.
    • The filtering is applied to two columns: [InvoiceItemID] and [InvoiceMonth].
  3. For the filtered rows, it performs a calculation. It multiplies the values in the columns [Unit Quantity - CY] and [Price per Unit - CY vs PY $].

  4. Finally, it sums up the results of these calculations for all the filtered rows, providing the final result.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
audreygerred
Super User
Super User

This DAX expression is used to calculate a value based on certain conditions. Here's how it works:

  1. It first checks if the column [Price per Unit - PY $] is blank. If it is, the result is also set to blank, and the calculation stops. This condition handles cases where the price for the previous year is missing or not available.

  2. If the [Price per Unit - PY $] is not blank, it proceeds to the next step. It filters the data in the table FactSalesInvoiceLine based on the following conditions:

    • It considers all rows but filters them down to those where [Price per Unit - PY $] is greater than 0.
    • The filtering is applied to two columns: [InvoiceItemID] and [InvoiceMonth].
  3. For the filtered rows, it performs a calculation. It multiplies the values in the columns [Unit Quantity - CY] and [Price per Unit - CY vs PY $].

  4. Finally, it sums up the results of these calculations for all the filtered rows, providing the final result.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

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.