Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Artur_Red
New Member

new measure

Hello

 

I am begginers in DAX. Please help me to solve my problem.

 

Below you can see report from database:

  • [Kontrahent Nazwa] - name of client
  • [M-c Operacji] - month (is not a date, it is a numebr in database)
  • [Cena sprzedaży netto [tys. zł]] - sum od sells by (filer by [Kontrahent Nazwa] and [M-c Operacji])
  • I want to add new measure, which will count [Cena sprzedaży netto [tys. zł]] by [Kontrahent Nazwa] & [M-c Operacji] + 1

dax.png

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Artur_Red ,

You can create a measure as below to get the sum sells for next month, please find the details in the attachment.

 

Sells for next month = 
VAR _selclient =
    SELECTEDVALUE ( 'Table'[Kontrahent Nazwa] )
VAR _selmonth =
    SELECTEDVALUE ( 'Table'[M-c Operacji] )
RETURN
    SUMX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Kontrahent Nazwa] = _selclient
                && 'Table'[M-c Operacji] = _selmonth + 1
        ),
        [Sum of sells]
    )

 

yingyinr_0-1666082517067.png

If the above one can't help you get the desired result, please provide some sample data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. And share the visual field settings as below screenshot. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
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

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @Artur_Red ,

You can create a measure as below to get the sum sells for next month, please find the details in the attachment.

 

Sells for next month = 
VAR _selclient =
    SELECTEDVALUE ( 'Table'[Kontrahent Nazwa] )
VAR _selmonth =
    SELECTEDVALUE ( 'Table'[M-c Operacji] )
RETURN
    SUMX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Kontrahent Nazwa] = _selclient
                && 'Table'[M-c Operacji] = _selmonth + 1
        ),
        [Sum of sells]
    )

 

yingyinr_0-1666082517067.png

If the above one can't help you get the desired result, please provide some sample data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. And share the visual field settings as below screenshot. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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

@Artur_Red , if you need next month data use date table and time intelligence. Date table should be joined with date of your tables

 

example

Month ahead Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],1,Month))

next month Sales = CALCULATE(SUM(Sales[Sales Amount]),nextmonth('Date'[Date]))

next MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],1,MONTH)))

 

 

Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

 

DAX Calendar - Standard Calendar, Non-Standard Calendar, 4-4-4 Calendar
https://www.youtube.com/watch?v=IsfCMzjKTQ0&t=145s

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors