This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
I would like to request help.
The attached date is my file. We give coupons to the registered guests from time to time.
As a data type is remarked as give or use for analysis.
Suppose for the month of January how many BD coupon was used? can be calculated as
Solved! Go to Solution.
Hi @jnn4282 ,
If you want to calculate the total used coupon of each CustomerID, each Coupon Name and each YearMonth , please try:
Coupon Count =
CALCULATE (
COUNTROWS ( 'テーブル2' ),
FILTER (
'テーブル2',
[CustomerID] = MAX ( 'テーブル2'[CustomerID] )
&& [coupon Name] = MAX ( 'テーブル2'[coupon Name] )
&& YEAR ( 'テーブル2'[UsedDate] ) = YEAR ( MAX ( 'テーブル2'[UsedDate] ) )
&& MONTH ( 'テーブル2'[UsedDate] ) = MONTH ( MAX ( 'テーブル2'[UsedDate] ) )
&& [coupon Type] = "use"
)
)
Total Coupon =
SWITCH (
MAX ( 'テーブル2'[coupon Name] ),
"BD", 15,
"Lunch", 20,
"Appetizer", 10,
"Drink", 5
) * [Coupon Count]
Output:
Or if you are still confused about it, please provide me with more details about your expected output to help us clarify your scenario.
Refer to:
How to Get Your Question Answered Quickly - Microsoft Power BI Community
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @jnn4282 ,
If you want to calculate the total used coupon of each CustomerID, each Coupon Name and each YearMonth , please try:
Coupon Count =
CALCULATE (
COUNTROWS ( 'テーブル2' ),
FILTER (
'テーブル2',
[CustomerID] = MAX ( 'テーブル2'[CustomerID] )
&& [coupon Name] = MAX ( 'テーブル2'[coupon Name] )
&& YEAR ( 'テーブル2'[UsedDate] ) = YEAR ( MAX ( 'テーブル2'[UsedDate] ) )
&& MONTH ( 'テーブル2'[UsedDate] ) = MONTH ( MAX ( 'テーブル2'[UsedDate] ) )
&& [coupon Type] = "use"
)
)
Total Coupon =
SWITCH (
MAX ( 'テーブル2'[coupon Name] ),
"BD", 15,
"Lunch", 20,
"Appetizer", 10,
"Drink", 5
) * [Coupon Count]
Output:
Or if you are still confused about it, please provide me with more details about your expected output to help us clarify your scenario.
Refer to:
How to Get Your Question Answered Quickly - Microsoft Power BI Community
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous
I appreciate your help. Your explanation was very easy to understand.
I am weak on nesting the function. You made my day.
Thank you so much.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 35 | |
| 32 | |
| 25 | |
| 22 | |
| 18 |
| User | Count |
|---|---|
| 66 | |
| 36 | |
| 32 | |
| 25 | |
| 23 |