Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Good afternoon, I need some help. I need to create an invoice count measure for customers who have never purchased and have purchased in the last two months. I have the two measurements below:
Bimonthly order frequency = CALCULATE(DISTINCTCOUNT(SBOPRODMS[Customer]),and(SBOPRODMS[invoice date]>=TODAY()-60,SBOPRODMS[document]="outgoing invoice"))
Total customers = CALCULATE(DISTINCTCOUNT(SBOPRODMS[Customer]),and(SBOPRODMS[invoice date]>=TODAY()-365,SBOPRODMS[document]="outgoing invoice"))
Solved! Go to Solution.
You may try
New Customers =
VAR AllOldCustomers =
CALCULATETABLE (
VALUES ( SBOPRODMS[Customer] ),
SBOPRODMS[invoice date]
< TODAY () - 60,
SBOPRODMS[document] = "outgoing invoice"
)
VAR AllNewCustomers =
CALCULATETABLE (
VALUES ( SBOPRODMS[Customer] ),
AND (
SBOPRODMS[invoice date]
>= TODAY () - 60,
SBOPRODMS[document] = "outgoing invoice"
)
)
RETURN
COUNTROWS ( EXCEPT ( AllNewCustomers, AllOldCustomers ) )
You may try
New Customers =
VAR AllOldCustomers =
CALCULATETABLE (
VALUES ( SBOPRODMS[Customer] ),
SBOPRODMS[invoice date]
< TODAY () - 60,
SBOPRODMS[document] = "outgoing invoice"
)
VAR AllNewCustomers =
CALCULATETABLE (
VALUES ( SBOPRODMS[Customer] ),
AND (
SBOPRODMS[invoice date]
>= TODAY () - 60,
SBOPRODMS[document] = "outgoing invoice"
)
)
RETURN
COUNTROWS ( EXCEPT ( AllNewCustomers, AllOldCustomers ) )
Thank you very much friend, the formula worked correctly. They have now requested the invoice value of each customer, the measure for invoice is: NET Value | NF = CALCULATE([NET Value],SBOPRODMS[Document]="Outgoing invoice"). How do I implement this data in the bimonthly customers formula??
Are you trying to calculate the net value of the customers we have calculated in the previous measure? If so you may try
NET Value | NF =
VAR AllOldCustomers =
CALCULATETABLE (
VALUES ( SBOPRODMS[Customer] ),
SBOPRODMS[invoice date]
< TODAY () - 60,
SBOPRODMS[document] = "outgoing invoice"
)
VAR AllNewCustomers =
CALCULATETABLE (
VALUES ( SBOPRODMS[Customer] ),
SBOPRODMS[invoice date]
>= TODAY () - 60,
SBOPRODMS[document] = "outgoing invoice"
)
RETURN
CALCULATE ( [NET Value], EXCEPT ( AllNewCustomers, AllOldCustomers ) )
Exactly, but when I insert the measure as a matrix column, it brings customers outside of what we calculated in the previous measure. The columns are in Portuguese but I believe you understand based on the formula.
I used your previous suggestion.
@Diego_Vialle
You are referencing a table! In my measure I am referencing another measure [Net Value]. I am using CALCULATE you are using COUNTROWS!
Because it is requesting a table and not measure...
Oh sorry, I hadn't seen Calculate. I changed it to Calculate and entered the invoice measure. However, it brings up all the clients, ignoring the previous calculation that we made only for the bimonthly clients.
But are getting correct values?
you can force the fiter in the filter pane for the previous measure set as "is not blank". Also try to iterate over the table but modt probably you will get wrong results but worth try then we can modify incuding all coulmns in the visual with iteration table
NET Value | NF =
VAR AllOldCustomers =
CALCULATETABLE (
VALUES ( SBOPRODMS[Customer] ),
SBOPRODMS[invoice date]
< TODAY () - 60,
SBOPRODMS[document] = "outgoing invoice"
)
VAR AllNewCustomers =
CALCULATETABLE (
VALUES ( SBOPRODMS[Customer] ),
SBOPRODMS[invoice date]
>= TODAY () - 60,
SBOPRODMS[document] = "outgoing invoice"
)
RETURN
SUMX ( EXCEPT ( AllNewCustomers, AllOldCustomers ), [NET Value] )
The New Bimonthly Customers column does not need to add the values, it is enough to bring the invoice value of each bimonthly customer.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
19 | |
15 | |
10 | |
9 | |
9 |
User | Count |
---|---|
15 | |
14 | |
12 | |
11 | |
11 |