The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
hi, I want to show Top Product (by Sub Main Category) based on Net Revenue for Current Fiscal Quarter, and also shows corresponding Net Revenue for last 3 Fiscal Quarter. I use Matrix table and Top N function (top 50 by Net Revenue) for " Sub Main Category" in the Visual filter to achieve this.
Power BI calculate and sort Net Revenue based on Total Net Revenue for all Fiscal Quarter in the Matrix table. It shows Winter Jacket as top revenue. However, I want to show top revenue for current Fiscal Qtr (FY25Q2), where Summer Dress should be top revenue.
I have custom Fiscal Calendar table where Qtr_Seq_No = 0 means current Fiscal Qtr, Qtr_Seq_No = -1 means last Fiscal Qtr, Qtr_Seq_No = -2 means last 2 Fiscal Qtr, etc.
I have Sales Revenue table that contains column for Sub Main Category, FY_Fiscal_Qtr (field that link to Fiscal Calendar table), Net Revenue, Net Qty.
The following is what I want to achieve:
1. Sort Top Net Revenue for Sub Main Category for Qtr_Seq_No = 0.
2. Show Rank No for Sub Main Category for Qtr_Seq_No = 0
Pls advise how to achieve this. Thank you in advance.
Solved! Go to Solution.
Hi @mbudiman ,
Please try code as below.
New Net Revenue =
IF (
HASONEVALUE ( 'Table'[FY_FISCAL_QTR] ),
[Net Revenue],
CALCULATE (
[Net Revenue],
FY_FISCAL_QTR,FY_FISCAL_QTR[QTR_SEQ_NO] = 0
)
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @mbudiman ,
According to your statement, I think you want to sort the category by the last FY_FISCAL_QTR.
As far as I know, when you sort the matrix by data in value field, Power BI will sort it by subtotal.
So I suggest you to try code as below to diy the subtotal for [Net Revenue].
New Net Revenue =
IF (
HASONEVALUE ( 'Table'[FY_FISCAL_QTR] ),
[Net Revenue],
CALCULATE (
[Net Revenue],
'Table'[FY_FISCAL_QTR] = MAX ( DimDate[FY_FISCAL_QTR] )
)
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hi Rico,
Thanks for providing solution. It almost achieve the desired result. However, my custom Financial Calendar table contains future fiscal Quarter too, so using MAX function to retrieve current Fiscal Qtr does not work.
I need to retrieve current FIscal Qtr using condition Qtr_Seq_No = 0. Pls advise DAX statement to achieve this.
The following is the contain of FY_FISCAL_QTR table. Qtr_Seq_No = 0 means current Fiscal Qtr, Qtr_Seq_No = -1 means last Fiscal Qtr, Qtr_Seq_No = 1 means next future Fiscal Qtr.
The colum Qtr Order is used for sorting FY_FISCAL_QTR in Matrix table.
FY_FISCAL_QTR | QTR_SEQ_NO | QTR ORDER |
FY24Q1 | -5 | 8 |
FY24Q2 | -4 | 7 |
FY24Q3 | -3 | 6 |
FY24Q4 | -2 | 5 |
FY25Q1 | -1 | 4 |
FY25Q2 | 0 | 3 |
FY25Q3 | -1 | 2 |
FY25Q4 | -2 | 1 |
Thank you in advance for your advise.
Hi @mbudiman ,
Please try code as below.
New Net Revenue =
IF (
HASONEVALUE ( 'Table'[FY_FISCAL_QTR] ),
[Net Revenue],
CALCULATE (
[Net Revenue],
FY_FISCAL_QTR,FY_FISCAL_QTR[QTR_SEQ_NO] = 0
)
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hi Rico,
The solution you provided above works perfectly !
Thank you so much 🙂
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
User | Count |
---|---|
68 | |
63 | |
59 | |
54 | |
28 |
User | Count |
---|---|
182 | |
81 | |
64 | |
46 | |
41 |