Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi all,
I need some suggestion, I got stuck for below usecase
this report is to compare the R12 and R6Sales between two products and then compare the ratio between R12Sales and R6Sales for both Products selected from slicer for a customer
I need to create a report like above for this I have ManagerName and AccountNumber that I can drag in a table visual. The Second and third table is showing R12Sales and R6Sales for Selected Product A and Product B, then we are calulating ratio in fourth table.
I am using below DAX for R12Sales, R6Sales
var ProductA=SELECTEDVALUE('Product '[ProductName])
R12Sales= Calculate([R12Sales], filter(Product,ProductA))
var ProductB=SELECTEDVALUE('Product '[ProductName])
R6Sales= Calculate([R6Sales], filter(Product,ProductB))
Do we really need to this in four tables or can we do in single table?
I really appreciate your help and looking forward for your thought and suggestions
Solved! Go to Solution.
Hi @amikm ,
You can try to add Index to both productA and productB tables, so that each row can have [Index] to act as a flag to compare, otherwise the comparison would be the total value of the two tables.
Here are the steps you can follow:
1. In Power Query -- Add Column – Index Column – From 1.
2. Create measure.
Measure_R16=
var _AR16=
SUMX(
FILTER(ALL(ProductA),
'ProductA'[Index]=MAX('ProductA'[Index])),[R16 Sales])
var _BR16=
SUMX(
FILTER(ALL(ProductB),
'ProductB'[Index]=MAX('ProductA'[Index])),[R16 Sales])
return
DIVIDE(_BR16,_AR16)
Measure_R6 =
var _AR6=
SUMX(
FILTER(ALL(ProductA),
'ProductA'[Index]=MAX('ProductA'[Index])),[R6 Sales])
var _BR6=
SUMX(
FILTER(ALL(ProductB),
'ProductB'[Index]=MAX('ProductB'[Index])),[R6 Sales])
return
DIVIDE(_BR6,_AR6)
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @amikm ,
You can try to add Index to both productA and productB tables, so that each row can have [Index] to act as a flag to compare, otherwise the comparison would be the total value of the two tables.
Here are the steps you can follow:
1. In Power Query -- Add Column – Index Column – From 1.
2. Create measure.
Measure_R16=
var _AR16=
SUMX(
FILTER(ALL(ProductA),
'ProductA'[Index]=MAX('ProductA'[Index])),[R16 Sales])
var _BR16=
SUMX(
FILTER(ALL(ProductB),
'ProductB'[Index]=MAX('ProductA'[Index])),[R16 Sales])
return
DIVIDE(_BR16,_AR16)
Measure_R6 =
var _AR6=
SUMX(
FILTER(ALL(ProductA),
'ProductA'[Index]=MAX('ProductA'[Index])),[R6 Sales])
var _BR6=
SUMX(
FILTER(ALL(ProductB),
'ProductB'[Index]=MAX('ProductB'[Index])),[R6 Sales])
return
DIVIDE(_BR6,_AR6)
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
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.
https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
110 | |
102 | |
99 | |
38 | |
37 |
User | Count |
---|---|
158 | |
125 | |
76 | |
74 | |
63 |