cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Community Support Team
Community Support Team

Re: Create a calculated row

hi, @balayka 

For your requirement, you could just use this simple way:

Create a measure by this formula:

Result = 
CALCULATE (
    COUNTA ( Sheet1[WalletID] ),
    FILTER (
        ALL ( Sheet1 ),
        Sheet1[Wallet Createddate] >= MIN ( Sheet1[Transaction Date] )
            && Sheet1[Wallet Createddate] <= MAX ( Sheet1[Transaction Date] )
    )
)

And for your case, Wallet Createddate and Transaction Date are all DateTime column, you'd better create a date column for them in the calculation.

For example:

New Wallet Createddate = DATE(YEAR(Sheet1[Wallet Createddate]),MONTH(Sheet1[Wallet Createddate]),DAY(Sheet1[Wallet Createddate]))
New Transaction Date = DATE(YEAR(Sheet1[Transaction Date]),MONTH(Sheet1[Transaction Date]),DAY(Sheet1[Transaction Date]))

then just adjust the formula as below:

Result 2 = 
CALCULATE (
    COUNTA ( Sheet1[WalletID] ),
    FILTER (
        ALL ( Sheet1 ),
        Sheet1[New Wallet Createddate] >= MIN ( Sheet1[New Transaction Date] )
            && Sheet1[New Wallet Createddate] <= MAX ( Sheet1[New Transaction Date] )
    )
)

Result:

1.JPG

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Community Support Team
Community Support Team

Re: Create a calculated row

hi, @balayka 

Just adjust the formula as below:

Result 3 = var _fromdate=CALCULATE(MIN(Sheet1[New Transaction Date]),ALLSELECTED(Sheet1)) 
var _enddate=CALCULATE(MAX(Sheet1[New Transaction Date]),ALLSELECTED(Sheet1))  return
CALCULATE (
    COUNTA ( Sheet1[WalletID] ),
    FILTER (
        Sheet1 ,
        Sheet1[New Wallet Createddate] >= _fromdate 
            && Sheet1[New Wallet Createddate] <= _enddate
    )
)

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
balayka Regular Visitor
Regular Visitor

Re: Create a calculated row

Logic is correct, finally I got what I need. I need your help on fixing one thing. Result3 should calculate distinct.

Highlighted
Community Support Team
Community Support Team

Re: Create a calculated row

hi, @balayka 

Use DISTINCTCOUNT in the formula

Result 3 = var _fromdate=CALCULATE(MIN(Sheet1[New Transaction Date]),ALLSELECTED(Sheet1)) 
var _enddate=CALCULATE(MAX(Sheet1[New Transaction Date]),ALLSELECTED(Sheet1))  return
CALCULATE (
    DISTINCTCOUNT( Sheet1[WalletID] ),
    FILTER (
        Sheet1 ,
        Sheet1[New Wallet Createddate] >= _fromdate 
            && Sheet1[New Wallet Createddate] <= _enddate
    )
)

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 254 members 2,621 guests
Please welcome our newest community members: