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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
I am trying to get a Card Visual based on the data table below.
Assuming we are in the month of June 2022.
1. No. of Companies with at least a loss 2 or 3 months ago (March or April)?
Expected Answer: 7
2. No. of Companies with losses in both 2 and 3 months ago (March and April)?
Expected Answer: 2
Your help would be highly appreciated.
CompanyDateNet Profit/(Loss)
| A | 31/01/2022 | ($1,406.00) |
| B | 31/01/2022 | $13,309.00 |
| C | 31/01/2022 | $14,388.00 |
| D | 31/01/2022 | $12,447.00 |
| E | 31/01/2022 | $3,415.00 |
| F | 31/01/2022 | ($2,931.00) |
| G | 31/01/2022 | ($39.00) |
| H | 31/01/2022 | $11,235.00 |
| I | 31/01/2022 | ($6,774.00) |
| J | 31/01/2022 | ($3,757.00) |
| A | 28/02/2022 | $9,891.00 |
| B | 28/02/2022 | ($5,565.00) |
| C | 28/02/2022 | $2,183.00 |
| D | 28/02/2022 | $4,494.00 |
| E | 28/02/2022 | $12,376.00 |
| F | 28/02/2022 | $2,865.00 |
| G | 28/02/2022 | ($1,324.00) |
| H | 28/02/2022 | ($2,504.00) |
| I | 28/02/2022 | $9,796.00 |
| J | 28/02/2022 | $5,156.00 |
| A | 31/03/2022 | ($7,198.00) |
| B | 31/03/2022 | ($2,044.00) |
| C | 31/03/2022 | ($7,462.00) |
| D | 31/03/2022 | $9,959.00 |
| E | 31/03/2022 | ($7,748.00) |
| F | 31/03/2022 | ($277.00) |
| G | 31/03/2022 | $10,819.00 |
| H | 31/03/2022 | $14,774.00 |
| I | 31/03/2022 | $18,887.00 |
| J | 31/03/2022 | ($1,810.00) |
| A | 30/04/2022 | $12,778.00 |
| B | 30/04/2022 | ($1,777.00) |
| C | 30/04/2022 | ($6,900.00) |
| D | 30/04/2022 | $4,351.00 |
| E | 30/04/2022 | $7,097.00 |
| F | 30/04/2022 | $8,289.00 |
| G | 30/04/2022 | $13,856.00 |
| H | 30/04/2022 | ($1,206.00) |
| I | 30/04/2022 | $19,995.00 |
| J | 30/04/2022 | $14,876.00 |
| A | 31/05/2022 | $8,356.00 |
| B | 31/05/2022 | ($6,637.00) |
| C | 31/05/2022 | $1,022.00 |
| D | 31/05/2022 | $16,946.00 |
| E | 31/05/2022 | ($4,525.00) |
| F | 31/05/2022 | $17,387.00 |
| G | 31/05/2022 | $18,425.00 |
| H | 31/05/2022 | $16,866.00 |
| I | 31/05/2022 | $9,884.00 |
| J | 31/05/2022 | ($5,695.00) |
Solved! Go to Solution.
Losses both months =
VAR twoMonthsAgo =
CALCULATETABLE (
VALUES ( 'Table'[Company] ),
PARALLELPERIOD ( 'Date'[Date], -2, MONTH ),
'Table'[Net profit / loss] < 0
)
VAR threeMonthsAgo =
CALCULATETABLE (
VALUES ( 'Table'[Company] ),
PARALLELPERIOD ( 'Date'[Date], -3, MONTH ),
'Table'[Net profit / loss] < 0
)
RETURN
COUNTROWS ( INTERSECT ( twoMonthsAgo, threeMonthsAgo ) )Losses either month =
VAR twoMonthsAgo =
CALCULATETABLE (
VALUES ( 'Table'[Company] ),
PARALLELPERIOD ( 'Date'[Date], -2, MONTH ),
'Table'[Net profit / loss] < 0
)
VAR threeMonthsAgo =
CALCULATETABLE (
VALUES ( 'Table'[Company] ),
PARALLELPERIOD ( 'Date'[Date], -3, MONTH ),
'Table'[Net profit / loss] < 0
)
RETURN
COUNTROWS ( DISTINCT ( UNION ( twoMonthsAgo, threeMonthsAgo ) ) )Add the 'Date'[Date] column as a filter to the card visuals and use the relative date setting to be in the current month
Thank you very much John. This worked perfectly!
Losses both months =
VAR twoMonthsAgo =
CALCULATETABLE (
VALUES ( 'Table'[Company] ),
PARALLELPERIOD ( 'Date'[Date], -2, MONTH ),
'Table'[Net profit / loss] < 0
)
VAR threeMonthsAgo =
CALCULATETABLE (
VALUES ( 'Table'[Company] ),
PARALLELPERIOD ( 'Date'[Date], -3, MONTH ),
'Table'[Net profit / loss] < 0
)
RETURN
COUNTROWS ( INTERSECT ( twoMonthsAgo, threeMonthsAgo ) )Losses either month =
VAR twoMonthsAgo =
CALCULATETABLE (
VALUES ( 'Table'[Company] ),
PARALLELPERIOD ( 'Date'[Date], -2, MONTH ),
'Table'[Net profit / loss] < 0
)
VAR threeMonthsAgo =
CALCULATETABLE (
VALUES ( 'Table'[Company] ),
PARALLELPERIOD ( 'Date'[Date], -3, MONTH ),
'Table'[Net profit / loss] < 0
)
RETURN
COUNTROWS ( DISTINCT ( UNION ( twoMonthsAgo, threeMonthsAgo ) ) )Add the 'Date'[Date] column as a filter to the card visuals and use the relative date setting to be in the current month
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 9 | |
| 6 | |
| 5 |
| User | Count |
|---|---|
| 27 | |
| 22 | |
| 19 | |
| 17 | |
| 11 |