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

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

Reply
ajet-p_91
Frequent Visitor

how to select a product name in if condition dax

Hello everyone,

I am new to this forum.

I have a data table with columns for date, category, product, and price. I am seeking to create a DAX function to calculate the total price of a specific product for the previous year combined with the current year for one product-only current year price. My objective is to display the total price for the current year. How can I accomplish this task?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ajet-p_91,

 

You don't need to create a DAX to fulfill your needs.

For the /Price/ column a numeric aggregation is automatically applied.

After adding the /Price/ column to the visual object, it will adaptively filter the display values based on the row and column labels.

 

For example, in the Matrix visualization object.

The rows labels are the /Product/ and /Date/ (year), and the value field is the /Price/.

 

The Price column will show the total price of each product for two years.

The next level down shows the total price of each product for last year and this year.

vdengllimsft_0-1724307289227.png

 

Another example is that you can add Product and Date fields to the slicer visual object.

You can manually choose to display the total price of which product for which year, or to display the total price for two years.

vdengllimsft_1-1724307306821.png

Best Regards,

Dengliang Li

 

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

1 REPLY 1
Anonymous
Not applicable

Hi @ajet-p_91,

 

You don't need to create a DAX to fulfill your needs.

For the /Price/ column a numeric aggregation is automatically applied.

After adding the /Price/ column to the visual object, it will adaptively filter the display values based on the row and column labels.

 

For example, in the Matrix visualization object.

The rows labels are the /Product/ and /Date/ (year), and the value field is the /Price/.

 

The Price column will show the total price of each product for two years.

The next level down shows the total price of each product for last year and this year.

vdengllimsft_0-1724307289227.png

 

Another example is that you can add Product and Date fields to the slicer visual object.

You can manually choose to display the total price of which product for which year, or to display the total price for two years.

vdengllimsft_1-1724307306821.png

Best Regards,

Dengliang Li

 

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.