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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi, I need to calculate the average unit selling price (AUSP) based on the condition below. Sample pbix here.
For example,
How to create a measure to calculate AUSP based on the condition above?
Solved! Go to Solution.
Hi @PBI_newuser ,
Please modify this formula :Current Year.
Current year =
VAR result1_ =
SUMX (
FILTER (
ALLSELECTED ( 'Append Table' ),
'Append Table'[next_count] = BLANK ()
&& 'Append Table'[last_count] = BLANK ()
&& [min_] = 3
&& 'Append Table'[Fis] = SELECTEDVALUE ( 'Calendar'[Fiscal Year] )
),
[Revenue Current Year]
)
RETURN
result1_
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @PBI_newuser ,
Does that make sense? If so, kindly mark my answer as the solution to close the case please. Thanks in advance.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous , I am sorry that I am not sure which part are you referring to for your question "Does that make sense?".
But, I would like to have the values in yellow box to be the same as red box. Would it be possible to do so?
Here is the sample.
Hi @PBI_newuser ,
Please modify this formula :Current Year.
Current year =
VAR result1_ =
SUMX (
FILTER (
ALLSELECTED ( 'Append Table' ),
'Append Table'[next_count] = BLANK ()
&& 'Append Table'[last_count] = BLANK ()
&& [min_] = 3
&& 'Append Table'[Fis] = SELECTEDVALUE ( 'Calendar'[Fiscal Year] )
),
[Revenue Current Year]
)
RETURN
result1_
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous , how to fix the "Current year" and "Last year" measures if only one Fiscal Year is selected? The result for "Current year" and "Last year" changed when FY2020 is not selected.
The ultimate goal is for user to select one Fiscal Year to see the current year and last year result. Here is the sample.
Hi @PBI_newuser ,
Hi @Username,
I have try the formula. It works well. Please ensure your expected output.
Create a measure.
Measure = IF(ISBLANK([Revenue Current Year])||ISBLANK([Revenue Last Year])||[Revenue Current Year]=1||[Revenue Last Year]=1,1,BLANK())
The filter the measure.
If I have misunderstood your meaning, please provide contact me with your desired output.
Best Regards
Community Support Team _ Polly
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 so much for your help on this but that was not my expected output.
I would like to remove all rows which is not highlighted in yellow. You may see those highlighted rows/contracts, they have blank/zero total revenue either in FY2021 or FY2022. I want to calculate the average unit selling price (AUSP) in the top table by removing those not highlighted rows. The expected output is displayed in red box.
Hi @PBI_newuser ,
Please try to see if it helps you.
Create measures.
Measure 3=
SUMX (
FILTER (
ALLSELECTED ( 'Append Table' ),
'Append Table'[Fis] = SELECTEDVALUE ( 'Calendar'[Fiscal Year] )
&& 'Append Table'[Contract Number]
= SELECTEDVALUE ( 'Append Table'[Contract Number] )
),
[Revenue Current Year]
)
Measure 2 = IF(ISBLANK([Measure 3]),1,BLANK())
Then filter the data.
Then Create measures.
min_ =
CALCULATE (
DISTINCTCOUNT ( 'Append Table'[YearMonth] ),
FILTER (
ALLSELECTED ( 'Append Table' ),
'Append Table'[Contract Number]
= SELECTEDVALUE ( 'Append Table'[Contract Number] )
&& 'Append Table'[Fis] = SELECTEDVALUE ( 'Calendar'[Fiscal Year] )
)
)
next_count =
CALCULATE (
DISTINCTCOUNT ( 'Append Table'[YearMonth] ),
FILTER (
ALLSELECTED ( 'Append Table' ),
'Append Table'[Contract Number]
= SELECTEDVALUE ( 'Append Table'[Contract Number] )
&& RIGHT ( 'Append Table'[Fis], 4 ) + 0
= RIGHT ( SELECTEDVALUE ( 'Calendar'[Fiscal Year] ), 4 ) + 1
)
)
last_count =
CALCULATE (
DISTINCTCOUNT ( 'Append Table'[YearMonth] ),
FILTER (
ALLSELECTED ( 'Append Table' ),
'Append Table'[Contract Number]
= SELECTEDVALUE ( 'Append Table'[Contract Number] )
&& RIGHT ( 'Append Table'[Fis], 4 ) - 0
= RIGHT ( SELECTEDVALUE ( 'Calendar'[Fiscal Year] ), 4 ) - 1
)
)
Current year =
VAR result1_ =
SUMX (
FILTER (
ALLSELECTED ( 'Append Table' ),
[min_] = 3
&& 'Append Table'[next_count] = BLANK ()
&& 'Append Table'[Fis] = SELECTEDVALUE ( 'Calendar'[Fiscal Year] )
),
[Revenue Current Year]
)
VAR result2_ =
SUMX (
FILTER (
ALLSELECTED ( 'Append Table' ),
'Append Table'[next_count] = BLANK ()
&& 'Append Table'[last_count] = 3
&& 'Append Table'[Fis] = SELECTEDVALUE ( 'Calendar'[Fiscal Year] )
),
[Revenue Current Year]
)
RETURN
IF ( ISBLANK ( result2_ ), result1_, result2_ )
If I have misunderstood your meaning, please provide contact me with your desired output.
Best Regards
Community Support Team _ Polly
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 so much for the solution. The table below seems correct but the "Current year" measure for FY2022 is incorrect. After removing the unecessary rows, the revenue for FY2021 = 12097 is correct but FY2022 "Current year" figure should show up as 12315.
Hi @PBI_newuser ,
If you have solve your problem, please share your way and mark your answer as the answer so it will be easier to search and be able to help more people.
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous , I haven't solve it. I want to sum the revenue after removing those rows and show it in the top table. How to get it?
@PBI_newuser , With help date table and time intellignece you can measure like these for thise qtr and last year same qtr (-4)
QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))
Last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))
Qtr Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(ENDOFQUARTER('Date'[Date])))
Last QUARTER Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD( ENDOFQUARTER(dateadd('Date'[Date],-1,QUARTER))))
Last QUARTER Sales = CALCULATE(SUM(Sales[Sales Amount]),PREVIOUSQUARTER(('Date'[Date])))
Last to last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-2,QUARTER)))
Next QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],1,QUARTER)))
Last year same QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,Year)))
Last year same QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(ENDOFQUARTER(dateadd('Date'[Date],-1,Year))))
trailing QTR = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,QUARTER))
trailing 4 QTR = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-4,QUARTER))
You need a measure like
=
if(isblank([QTD Sales]) || isblank([Last year same QTD Sales]) , 1,blank() )
or
if(coalesce([QTD Sales],0) =0 || coalesce([Last year same QTD Sales],0) =0 , 1, blank() )
Hi, there are some conditions I would exclude from the sum. Sample here.
Hi @PBI_newuser
I think this is a challenge to solve it, I'll need some time to think about it. Of course, others will help you also.
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-xiaotang , thank you so much! I have posted a similar case with simplified condition. Is that possible to solve? If yes, then this is not needed. Thanks again!
https://community.powerbi.com/t5/Desktop/Remove-rows-based-on-condition/m-p/2329718#M841241
Hi @PBI_newuser
Thanks for your reply. We will check that link later. If this post is repeated or no longer needed for discussion, to help other users find posts more accurately, could you please delete it? Thanks
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-xiaotang , I wanted to delete this post but there is no "Delete" selection. May I know how to delete it?
Hi @PBI_newuser
I noticed that another similar post of yours has been resolved. This post will be merged with it later. Thanks for your contribution to improve Power BI.❤️
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hi @amitchandak, i tried to create a measure and filter to 1 but it doesn't work. How to modify the measure?
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 37 | |
| 33 | |
| 29 | |
| 26 |
| User | Count |
|---|---|
| 134 | |
| 104 | |
| 63 | |
| 60 | |
| 55 |