Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Solved! Go to Solution.
Please try a column expression like this (DAX column, not a query column)
Invoice Status =
VAR vMonthsOld =
DATEDIFF (
Table[InvoiceDate],
TODAY (),
MONTH
)
VAR vResult =
SWITCH (
TRUE (),
vMonthsOld <= 4, "Active",
vMonthsOld <= 8, "Active A",
vMonthsOld <= 12, "Active B",
"Inactive"
)
RETURN
vResult
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Yes. I think you could replace the vMonthsOld variable with
vMonthsOld = CALCULATE(MAX('P21&IBS Data'[Date]), ALLEXCEPT('P21&IBS Data', 'P21&IBS Data'[CustomerName]))
If not, please share some representative mock data for a modified solution.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Yes. I think you could replace the vMonthsOld variable with
vMonthsOld = CALCULATE(MAX('P21&IBS Data'[Date]), ALLEXCEPT('P21&IBS Data', 'P21&IBS Data'[CustomerName]))
If not, please share some representative mock data for a modified solution.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
I eneded up creating another date column for last invocie date and using that in the model you provided. Worked great, plus I can have a column that tells me their exact last invoice dat. I appreciate your help, thank you.
JW
Please try a column expression like this (DAX column, not a query column)
Invoice Status =
VAR vMonthsOld =
DATEDIFF (
Table[InvoiceDate],
TODAY (),
MONTH
)
VAR vResult =
SWITCH (
TRUE (),
vMonthsOld <= 4, "Active",
vMonthsOld <= 8, "Active A",
vMonthsOld <= 12, "Active B",
"Inactive"
)
RETURN
vResult
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thank you! This worked great, however, because my data goes line by line with invoices, this just bases it on where the date falls with that specific invoice. Is there a way to highlight the relative time from last invoice date by customer name within the expression you sent? I tried adding this into the expression,
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |