Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have two tables:
SALES
id | product | cart_id | week |
1 | A | 90 | 25 |
2 | B | 90 | 25 |
3 | C | 91 | 27 |
4 | A | 91 | 27 |
5 | A | 91 | 27 |
SEPCIAL_SALES
id | product | cart_id | week |
17 | A | 234 | 25 |
18 | B | 234 | 25 |
18 | C | 235 | 25 |
19 | A | 236 | 27 |
20 | C | 236 | 27 |
Now I want to divide the distinct count of the card_id like:
COUNT(DISTINCT(SALES[card_id])) / COUNT(DISTINCT(SEPCIAL_SALES[card_id]))
And the results should be plotted per week.
In this case:
25 | 1/2 |
27 | 1/1 |
How do I do that?
Solved! Go to Solution.
Hi, @Anonymous
Create a bridge table using the week field, and establish a one-to-many relationship with the other two tables
then try to create measures like below:
_CountOfSales =
CALCULATE (
DISTINCTCOUNT ( 'SALES'[cart_id] ),
FILTER ( ALL ( 'SALES' ), [week] = MAX ( 'bridgeTable'[Week] ) )
)
_CountOfSepcialSales =
CALCULATE (
DISTINCTCOUNT ( SEPCIAL_SALES[cart_id] ),
FILTER ( ALL ( 'SALES' ), [week] = MAX ( 'bridgeTable'[Week] ) )
)
_Result =
FORMAT ( 'Mea'[_CountOfSales], "General Number" ) & "/"
& FORMAT ( 'Mea'[_CountOfSepcialSales], "General Number" )
Sample:
result:
Please refer to the attachment below for details
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
Create a bridge table using the week field, and establish a one-to-many relationship with the other two tables
then try to create measures like below:
_CountOfSales =
CALCULATE (
DISTINCTCOUNT ( 'SALES'[cart_id] ),
FILTER ( ALL ( 'SALES' ), [week] = MAX ( 'bridgeTable'[Week] ) )
)
_CountOfSepcialSales =
CALCULATE (
DISTINCTCOUNT ( SEPCIAL_SALES[cart_id] ),
FILTER ( ALL ( 'SALES' ), [week] = MAX ( 'bridgeTable'[Week] ) )
)
_Result =
FORMAT ( 'Mea'[_CountOfSales], "General Number" ) & "/"
& FORMAT ( 'Mea'[_CountOfSepcialSales], "General Number" )
Sample:
result:
Please refer to the attachment below for details
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , You need to create common tables like a week, product, and card id and analyze data with these common dimensions
Bridge Table: https://www.youtube.com/watch?v=Bkf35Roman8&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=19
You need to be in star schema
https://www.sqlbi.com/articles/the-importance-of-star-schemas-in-power-bi/
This is not helpful.
The solution was to build a quickmeasure in the plot.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
94 | |
75 | |
63 | |
62 |
User | Count |
---|---|
137 | |
105 | |
104 | |
80 | |
63 |