The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I use this function to show the data for the current date selected and the same time a year ago in my table but sometimes I don't have data for the previous period and I wonder whether I can exclude that. As you see in this image I don't have data for Sept 2021 so I would like to exclude that row from the table.
Solved! Go to Solution.
@stribor45 , Try using below method
HasDataLastYear =
VAR PreviousYear = CALCULATE(MAX('YourTable'[Date]), SAMEPERIODLASTYEAR('YourTable'[Date]))
RETURN
IF(
NOT(ISBLANK(CALCULATE(SUM('YourTable'[YourMeasure]), 'YourTable'[Date] = PreviousYear))),
1,
0
)
Please accept as solution and give kudos if it helps
Proud to be a Super User! |
|
Hi @stribor45 ,
Hope all is going well.
To achieve your needs please follow these steps:
1. Create a measure that checks if the previous year's data is empty. This is done to filter out rows that have no data for the previous year.
measure = ISBLANK([Table])
2. After selecting the visual object, in the "Filter" pane on the right, apply measure as a filter to the current visual object. Set the filter condition to display data when the value of "measure" is FALSE.
If you want to learn more, please refer to the following documents:
ISBLANK function (DAX) - DAX | Microsoft Learn
If you have any questions or need help, please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Hi @stribor45 ,
Hope all is going well.
To achieve your needs please follow these steps:
1. Create a measure that checks if the previous year's data is empty. This is done to filter out rows that have no data for the previous year.
measure = ISBLANK([Table])
2. After selecting the visual object, in the "Filter" pane on the right, apply measure as a filter to the current visual object. Set the filter condition to display data when the value of "measure" is FALSE.
If you want to learn more, please refer to the following documents:
ISBLANK function (DAX) - DAX | Microsoft Learn
If you have any questions or need help, please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
@stribor45 , Try using below method
HasDataLastYear =
VAR PreviousYear = CALCULATE(MAX('YourTable'[Date]), SAMEPERIODLASTYEAR('YourTable'[Date]))
RETURN
IF(
NOT(ISBLANK(CALCULATE(SUM('YourTable'[YourMeasure]), 'YourTable'[Date] = PreviousYear))),
1,
0
)
Please accept as solution and give kudos if it helps
Proud to be a Super User! |
|
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
25 | |
13 | |
12 | |
8 | |
8 |